Thanks to the ability to put each thread into a wait state when there are no tasks to consume, we avoid the constant mutex lock/unlock operations and the checks performed during each iteration when using std::lock_guard.
A thread will be notified when a task is added to the queue. If the conditions are met, it will acquire the mutex lock and wake from its wait state, allowing the task to be consumed or executed
Thanks to the ability to put each thread into a wait state when there are no tasks to consume, we avoid the constant mutex lock/unlock operations and the checks performed during each iteration when using std::lock_guard.
A thread will be notified when a task is added to the queue. If the conditions are met, it will acquire the mutex lock and wake from its wait state, allowing the task to be consumed or executed