# HG changeset patch # User Alain Mazy # Date 1675074672 -3600 # Node ID 6ff13c95f62fee669ec01939e80be0ac346c1ee5 # Parent 2df546a76e17f82e480ca049011ef36bbe2b5d88 ThreadedSetOfInstancesJob: reduce cpu consumption of job main thread diff -r 2df546a76e17 -r 6ff13c95f62f OrthancServer/Sources/ServerJobs/ThreadedSetOfInstancesJob.cpp --- a/OrthancServer/Sources/ServerJobs/ThreadedSetOfInstancesJob.cpp Fri Jan 27 12:56:55 2023 +0100 +++ b/OrthancServer/Sources/ServerJobs/ThreadedSetOfInstancesJob.cpp Mon Jan 30 11:31:12 2023 +0100 @@ -156,6 +156,9 @@ // wait until all instances are processed by the workers if (instancesToProcessQueue_.GetSize() != 0) { + // "slow down" the job main thread, to avoid using 100% of a core simply to check that other threads are done + boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + return JobStepResult::Continue(); } else