changeset 7044:ada5c9e13781

added missing lock
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2026 13:11:34 +0200
parents cb558bd6ba67
children 3b85dc5a36ed
files OrthancFramework/Sources/HttpServer/HttpServer.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Tue Aug 11 12:38:13 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Tue Aug 11 13:11:34 2026 +0200
@@ -1828,8 +1828,11 @@
 
   void HttpServer::Start()
   {
-    // reset thread counter used to generate HTTP thread names.
-    threadCounter_ = 0;
+    {
+      // reset thread counter used to generate HTTP thread names.
+      boost::unique_lock<boost::shared_mutex> lock(threadCounterMutex_);
+      threadCounter_ = 0;
+    }
 
 #if ORTHANC_ENABLE_MONGOOSE == 1
     CLOG(INFO, HTTP) << "Starting embedded Web server using Mongoose";
@@ -2473,7 +2476,7 @@
   std::string HttpServer::GetCurrentThreadName()
   {
     // threads are created in CivetWeb -> assign them a name the first time they are used
-    boost::thread::id threadId = boost::this_thread::get_id();
+    const boost::thread::id threadId = boost::this_thread::get_id();
 
     boost::upgrade_lock<boost::shared_mutex> readerLock(threadCounterMutex_); // reader lock to check if the threadId has already been registered