Yes, they wait without consuming any CPU resources. Only spinlocks do a busy wait.
Does waiting on a mutex, condition variable or I/O automatically yield() the thread?
-
16-01-2022 - |
Domanda
It would seem to be a no-brainer, but just wanted to check if this is guaranteed (on Linux). Is the thread precluded from scheduling until the wait condition is satisfied? Or will the thread get scheduled, figure out it's still waiting and yield() again, wasting resources?
The reason I am asking is, if I have X threads running, and some threads are blocked for whatever reason, will the blocked threads get in the way of runnable threads (assuming they are the same priority)?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow