Mercurial > hg > orthanc-transfers
changeset 113:6ba13c5c196a
fix handling of thread names
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Fri, 14 Aug 2026 08:46:57 +0200 |
| parents | ec575e7aea27 |
| children | fc60db3d2681 |
| files | Framework/DownloadArea.cpp Framework/OrthancInstancesCache.cpp |
| diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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<std::string>(commitThreadsCounter++)); + threadName = std::string("TF-COMMIT-") + boost::lexical_cast<std::string>(commitThreadsCounter++); commitThreadsCounter %= 1000000; } + Orthanc::Logging::ScopedCurrentThreadNameSetter threadNameSetter(threadName); + while (true) { try
--- 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 }
