Changeset View
Changeset View
Standalone View
Standalone View
src/scheduler.cpp
Show All 21 Lines | void CScheduler::serviceQueue() { | ||||
++nThreadsServicingQueue; | ++nThreadsServicingQueue; | ||||
// newTaskMutex is locked throughout this loop EXCEPT when the thread is | // newTaskMutex is locked throughout this loop EXCEPT when the thread is | ||||
// waiting or when the user's function is called. | // waiting or when the user's function is called. | ||||
while (!shouldStop()) { | while (!shouldStop()) { | ||||
try { | try { | ||||
if (!shouldStop() && taskQueue.empty()) { | if (!shouldStop() && taskQueue.empty()) { | ||||
reverse_lock<boost::unique_lock<boost::mutex>> rlock(lock); | reverse_lock<boost::unique_lock<boost::mutex>> rlock(lock); | ||||
// Use this chance to get more entropy | |||||
RandAddSeedSleep(); | |||||
} | } | ||||
while (!shouldStop() && taskQueue.empty()) { | while (!shouldStop() && taskQueue.empty()) { | ||||
// Wait until there is something to do. | // Wait until there is something to do. | ||||
newTaskScheduled.wait(lock); | newTaskScheduled.wait(lock); | ||||
} | } | ||||
// Wait until either there is a new task, or until the time of the | // Wait until either there is a new task, or until the time of the | ||||
// first item on the queue. | // first item on the queue. | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |