Mercurial > hg > orthanc
diff OrthancFramework/Sources/DicomNetworking/DicomServer.cpp @ 4793:fc2ba1ce6538
new configuration 'DicomThreadsCount'
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 30 Sep 2021 15:03:35 +0200 |
parents | 82a314325351 |
children | 22d5b611dea7 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/DicomServer.cpp Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/DicomServer.cpp Thu Sep 30 15:03:35 2021 +0200 @@ -424,7 +424,10 @@ #endif continue_ = true; - pimpl_->workers_.reset(new RunnableWorkersPool(4)); // Use 4 workers - TODO as a parameter? + + CLOG(INFO, DICOM) << "The embedded DICOM server will use " << threadsCount_ << " threads"; + + pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_)); pimpl_->thread_ = boost::thread(ServerThread, this, maximumPduLength_, useDicomTls_); } @@ -588,4 +591,16 @@ { return remoteCertificateRequired_; } + + void DicomServer::SetThreadsCount(unsigned int threads) + { + if (threads == 0) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + + Stop(); + threadsCount_ = threads; + } + }