diff --git a/module/Library/Worker.cpp b/module/Library/Worker.cpp index 9ccbd161..e3c207a9 100644 --- a/module/Library/Worker.cpp +++ b/module/Library/Worker.cpp @@ -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) diff --git a/module/Library/Worker.hpp b/module/Library/Worker.hpp index 5225b695..3c8ffab5 100644 --- a/module/Library/Worker.hpp +++ b/module/Library/Worker.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include // ------------------------------------------------------------------------------------------------