Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 5183:5ec3dcdf78b9
renamed HousekeeperThread as MemoryTrimmingThread to avoid confusion with Housekeeper plugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 25 Mar 2023 12:07:39 +0100 |
parents | cddf28cfcd8d |
children | dd085f7e7e71 |
comparison
equal
deleted
inserted
replaced
5182:cddf28cfcd8d | 5183:5ec3dcdf78b9 |
---|---|
107 { | 107 { |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 #if HAVE_MALLOC_TRIM == 1 | 111 #if HAVE_MALLOC_TRIM == 1 |
112 void ServerContext::HousekeeperThread(ServerContext* that, | 112 void ServerContext::MemoryTrimmingThread(ServerContext* that, |
113 unsigned int sleepDelay) | 113 unsigned int sleepDelay) |
114 { | 114 { |
115 // note, right now, this thread is started only if malloc_trim is defined | 115 // This thread is started only if malloc_trim is defined |
116 while (!that->done_) | 116 while (!that->done_) |
117 { | 117 { |
118 boost::this_thread::sleep(boost::posix_time::milliseconds(sleepDelay)); | 118 boost::this_thread::sleep(boost::posix_time::milliseconds(sleepDelay)); |
119 | 119 |
120 // If possible, gives memory back to the system | 120 // If possible, gives memory back to the system |
437 | 437 |
438 listeners_.push_back(ServerListener(luaListener_, "Lua")); | 438 listeners_.push_back(ServerListener(luaListener_, "Lua")); |
439 changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100)); | 439 changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100)); |
440 | 440 |
441 #if HAVE_MALLOC_TRIM == 1 | 441 #if HAVE_MALLOC_TRIM == 1 |
442 housekeeperThread_ = boost::thread(HousekeeperThread, this, 100); | 442 memoryTrimmingThread_ = boost::thread(MemoryTrimmingThread, this, 100); |
443 #else | 443 #else |
444 LOG(INFO) << "Your platform does not support malloc_trim(), not starting the housekeeper thread"; | 444 LOG(INFO) << "Your platform does not support malloc_trim(), not starting the memory trimming thread"; |
445 #endif | 445 #endif |
446 | 446 |
447 dynamic_cast<DcmtkTranscoder&>(*dcmtkTranscoder_).SetLossyQuality(lossyQuality); | 447 dynamic_cast<DcmtkTranscoder&>(*dcmtkTranscoder_).SetLossyQuality(lossyQuality); |
448 } | 448 } |
449 catch (OrthancException&) | 449 catch (OrthancException&) |
484 if (saveJobsThread_.joinable()) | 484 if (saveJobsThread_.joinable()) |
485 { | 485 { |
486 saveJobsThread_.join(); | 486 saveJobsThread_.join(); |
487 } | 487 } |
488 | 488 |
489 if (housekeeperThread_.joinable()) | 489 if (memoryTrimmingThread_.joinable()) |
490 { | 490 { |
491 housekeeperThread_.join(); | 491 memoryTrimmingThread_.join(); |
492 } | 492 } |
493 | 493 |
494 jobsEngine_.GetRegistry().ResetObserver(); | 494 jobsEngine_.GetRegistry().ResetObserver(); |
495 | 495 |
496 if (isJobsEngineUnserialized_) | 496 if (isJobsEngineUnserialized_) |