Question

Does the boost::condition_variable::notify_one() function automatically resume execution of the thread it is unblocking or is that undefined and dependent on how the OS schedules the thread?

I am not all that familiar with threading and how the OS interacts with them so any insight into notify_one()'s implementation would be helpful.

Thanks

Was it helpful?

Solution

Boost doesn't resume, nor schedule anything, it talks to the OS and the OS takes care of multi-tasking. The OS will most likely unblock the thread some time in the future; you could have a real-time OS with guarantees (like "unblocked threads will always start execution within X milliseconds"), but Boost doesn't try to guarantee that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top