mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Do not hammer the CPU if there are no jobs.
This commit is contained in:
parent
cc69b15190
commit
97fe1101e3
@ -366,7 +366,11 @@ void Worker::Work()
|
||||
// Try to get a job from the queue
|
||||
if (!m_PendingJobs.try_dequeue(job))
|
||||
{
|
||||
return; // No jobs
|
||||
using namespace std::chrono_literals;
|
||||
// Do not hammer the CPU if there are no jobs
|
||||
std::this_thread::sleep_for(50ms);
|
||||
// Try again
|
||||
return;
|
||||
}
|
||||
// Identify the job type
|
||||
switch (job->mType)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user