Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 5450:9ffd6d18daf3 pg-transactions
log lines now contain the thread name
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 05 Dec 2023 16:26:35 +0100 |
parents | ac68a4383e51 |
children | 38f1d06875ad 48b8dae6dc77 |
comparison
equal
deleted
inserted
replaced
5449:29858f424fc7 | 5450:9ffd6d18daf3 |
---|---|
110 | 110 |
111 #if HAVE_MALLOC_TRIM == 1 | 111 #if HAVE_MALLOC_TRIM == 1 |
112 void ServerContext::MemoryTrimmingThread(ServerContext* that, | 112 void ServerContext::MemoryTrimmingThread(ServerContext* that, |
113 unsigned int intervalInSeconds) | 113 unsigned int intervalInSeconds) |
114 { | 114 { |
115 Logging::SetCurrentThreadName("MEMORY-TRIM"); | |
116 | |
115 boost::posix_time::ptime lastExecution = boost::posix_time::second_clock::universal_time(); | 117 boost::posix_time::ptime lastExecution = boost::posix_time::second_clock::universal_time(); |
116 | 118 |
117 // This thread is started only if malloc_trim is defined | 119 // This thread is started only if malloc_trim is defined |
118 while (!that->done_) | 120 while (!that->done_) |
119 { | 121 { |
138 | 140 |
139 | 141 |
140 void ServerContext::ChangeThread(ServerContext* that, | 142 void ServerContext::ChangeThread(ServerContext* that, |
141 unsigned int sleepDelay) | 143 unsigned int sleepDelay) |
142 { | 144 { |
145 Logging::SetCurrentThreadName("CHANGES"); | |
146 | |
143 while (!that->done_) | 147 while (!that->done_) |
144 { | 148 { |
145 std::unique_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(sleepDelay)); | 149 std::unique_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(sleepDelay)); |
146 | 150 |
147 if (obj.get() != NULL) | 151 if (obj.get() != NULL) |
180 | 184 |
181 | 185 |
182 void ServerContext::JobEventsThread(ServerContext* that, | 186 void ServerContext::JobEventsThread(ServerContext* that, |
183 unsigned int sleepDelay) | 187 unsigned int sleepDelay) |
184 { | 188 { |
189 Logging::SetCurrentThreadName("JOB-EVENTS"); | |
190 | |
185 while (!that->done_) | 191 while (!that->done_) |
186 { | 192 { |
187 std::unique_ptr<IDynamicObject> obj(that->pendingJobEvents_.Dequeue(sleepDelay)); | 193 std::unique_ptr<IDynamicObject> obj(that->pendingJobEvents_.Dequeue(sleepDelay)); |
188 | 194 |
189 if (obj.get() != NULL) | 195 if (obj.get() != NULL) |
222 | 228 |
223 | 229 |
224 void ServerContext::SaveJobsThread(ServerContext* that, | 230 void ServerContext::SaveJobsThread(ServerContext* that, |
225 unsigned int sleepDelay) | 231 unsigned int sleepDelay) |
226 { | 232 { |
233 Logging::SetCurrentThreadName("SAVE-JOBS"); | |
234 | |
227 static const boost::posix_time::time_duration PERIODICITY = | 235 static const boost::posix_time::time_duration PERIODICITY = |
228 boost::posix_time::seconds(10); | 236 boost::posix_time::seconds(10); |
229 | 237 |
230 boost::posix_time::ptime next = | 238 boost::posix_time::ptime next = |
231 boost::posix_time::microsec_clock::universal_time() + PERIODICITY; | 239 boost::posix_time::microsec_clock::universal_time() + PERIODICITY; |