# HG changeset patch # User Sebastien Jodogne # Date 1786690017 -7200 # Node ID 6ba13c5c196a56797c3b1d2e6f452d0e268b8354 # Parent ec575e7aea2748260fa509c4a7ee7b1e462cf390 fix handling of thread names diff -r ec575e7aea27 -r 6ba13c5c196a Framework/DownloadArea.cpp --- a/Framework/DownloadArea.cpp Mon Aug 10 10:30:32 2026 +0200 +++ b/Framework/DownloadArea.cpp Fri Aug 14 08:46:57 2026 +0200 @@ -32,9 +32,7 @@ namespace OrthancPlugins { - static uint32_t commitWorkerThreadsCount = 1; - static boost::mutex commitThreadsCounterMutex; - static uint32_t commitThreadsCounter = 0; + static uint32_t commitWorkerThreadsCount = 1; void DownloadArea::SetCommitWorkerThreadsCount(uint32_t workersCount) { @@ -271,12 +269,19 @@ void DownloadArea::CommitWorker(DownloadArea* that) { + std::string threadName; + { + static boost::mutex commitThreadsCounterMutex; + static uint32_t commitThreadsCounter = 0; + boost::mutex::scoped_lock lock(commitThreadsCounterMutex); - Orthanc::Logging::SetCurrentThreadName(std::string("TF-COMMIT-") + boost::lexical_cast(commitThreadsCounter++)); + threadName = std::string("TF-COMMIT-") + boost::lexical_cast(commitThreadsCounter++); commitThreadsCounter %= 1000000; } + Orthanc::Logging::ScopedCurrentThreadNameSetter threadNameSetter(threadName); + while (true) { try diff -r ec575e7aea27 -r 6ba13c5c196a Framework/OrthancInstancesCache.cpp --- a/Framework/OrthancInstancesCache.cpp Mon Aug 10 10:30:32 2026 +0200 +++ b/Framework/OrthancInstancesCache.cpp Fri Aug 14 08:46:57 2026 +0200 @@ -81,7 +81,6 @@ void OrthancInstancesCache::CheckInvariants() { -#ifndef NDEBUG size_t s = 0; assert(content_.size() == index_.GetSize()); @@ -105,7 +104,6 @@ content_.size() == 1 && memorySize_ == (content_.begin())->second->GetInfo().GetSize()); } -#endif }