What limitations does the Python GIL place on multithreading? (with example)
I'm having trouble getting clarity on this.
I have a program, say, with three threads - A, B and C.
C is a 'hardware manager', A and B perform their own tasks using APScheduler for scheduling and as part of their routines, make requests of the hardware manager thread.
If I use a time.sleep() in thread C (sometimes necessary to wait on certain hardware-related things to complete), can other methods on thread C be called?
eg. 'A' asks 'C' to turn on a relay which powers a modem. The method incorporates a sleep(), so once it returns, 'A' can expect a network connection to be present. During this time though, 'B' might request a battery voltage reading from an ADC. Should I expect 'B' to be stuck waiting for the first method call to return?
OK, so practically speaking, I think the answer is that time.sleep() will yield to other waiting threads.
Perhaps other limitations or concerns will rear their heads in time, but at this stage, performance is not the issue, only concurrency.