Mercurial > hg > orthanc
changeset 6955:2b7c43addced streaming
fix reused thread names
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Wed, 17 Jun 2026 18:00:52 +0200 |
| parents | 9e6a841aecc1 |
| children | 17dba3e3c7e4 |
| files | OrthancFramework/Sources/Logging.cpp OrthancFramework/UnitTestsSources/MemoryCacheTests.cpp |
| diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Logging.cpp Wed Jun 17 17:34:51 2026 +0200 +++ b/OrthancFramework/Sources/Logging.cpp Wed Jun 17 18:00:52 2026 +0200 @@ -732,6 +732,7 @@ throw OrthancException(ErrorCode_InternalError, std::string("Thread name can not exceed 16 characters: ") + name); } + // std::cout << "+++++ SetCurrentThreadNameInternal " << id << " " << name << std::endl; #if !defined(NDEBUG) if (threadNames_.find(id) != threadNames_.end()) { @@ -783,6 +784,8 @@ boost::thread::id threadId = boost::this_thread::get_id(); boost::recursive_mutex::scoped_lock lock(threadNamesMutex_); + + // std::cout << "+++++ ClearCurrentThreadName " << threadId << std::endl; threadNames_.erase(threadId); } else if (hasClearThreadName_) // only recent runtimes support it (from 1.12.12)
--- a/OrthancFramework/UnitTestsSources/MemoryCacheTests.cpp Wed Jun 17 17:34:51 2026 +0200 +++ b/OrthancFramework/UnitTestsSources/MemoryCacheTests.cpp Wed Jun 17 18:00:52 2026 +0200 @@ -403,6 +403,8 @@ void ThreadingScenarioHappyThread1() { + Orthanc::Logging::ScopedThreadNameSetter setter("MEM-TEST-1"); + // the first thread to call Fetch (will be in charge of adding) Orthanc::MemoryStringCache::Accessor a(ThreadingScenarioHappyCache); std::string v; @@ -430,6 +432,8 @@ void ThreadingScenarioHappyThread2() { + Orthanc::Logging::ScopedThreadNameSetter setter("MEM-TEST-2"); + Orthanc::MemoryStringCache::Accessor a(ThreadingScenarioHappyCache); std::string v; @@ -472,6 +476,8 @@ void ThreadingScenarioFailureThread1() { + Orthanc::Logging::ScopedThreadNameSetter setter("MEM-TEST-1"); + // the first thread to call Fetch (will be in charge of adding) Orthanc::MemoryStringCache::Accessor a(ThreadingScenarioFailureCache); std::string v; @@ -495,6 +501,8 @@ void ThreadingScenarioFailureThread2() { + Orthanc::Logging::ScopedThreadNameSetter setter("MEM-TEST-2"); + Orthanc::MemoryStringCache::Accessor a(ThreadingScenarioFailureCache); std::string v; @@ -531,6 +539,8 @@ void ThreadingScenarioInvalidateThread1() { + Orthanc::Logging::ScopedThreadNameSetter setter("MEM-TEST-1"); + // the first thread to call Fetch (will be in charge of adding) Orthanc::MemoryStringCache::Accessor a(ThreadingScenarioInvalidateCache); std::string v; @@ -555,6 +565,8 @@ void ThreadingScenarioInvalidateThread2() { + Orthanc::Logging::ScopedThreadNameSetter setter("MEM-TEST-2"); + Orthanc::MemoryStringCache::Accessor a(ThreadingScenarioInvalidateCache); std::string v;
