Mercurial > hg > orthanc-stone
diff Framework/Oracle/ThreadedOracle.cpp @ 1109:79b1b541fe15 broker
ThreadedOracle::SetRootDirectory()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Oct 2019 11:56:10 +0100 |
parents | 98cdfe5768a4 |
children | a8bf81756839 |
line wrap: on
line diff
--- a/Framework/Oracle/ThreadedOracle.cpp Wed Oct 30 10:23:12 2019 +0100 +++ b/Framework/Oracle/ThreadedOracle.cpp Wed Oct 30 11:56:10 2019 +0100 @@ -176,7 +176,13 @@ else { GenericOracleRunner runner; - runner.SetOrthanc(orthanc_); + + { + boost::mutex::scoped_lock lock(mutex_); + runner.SetOrthanc(orthanc_); + runner.SetRootDirectory(rootDirectory_); + } + std::auto_ptr<IMessage> message(runner.Run(item.GetCommand())); emitter_.EmitMessage(item.GetReceiver(), *message); @@ -263,6 +269,7 @@ ThreadedOracle::ThreadedOracle(IMessageEmitter& emitter) : emitter_(emitter), + rootDirectory_("."), state_(State_Setup), workers_(4), sleepingCommands_(new SleepingCommands), @@ -297,16 +304,14 @@ void ThreadedOracle::SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc) { boost::mutex::scoped_lock lock(mutex_); + orthanc_ = orthanc; + } - if (state_ != State_Setup) - { - LOG(ERROR) << "ThreadedOracle::SetOrthancParameters(): (state_ != State_Setup)"; - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - else - { - orthanc_ = orthanc; - } + + void ThreadedOracle::SetRootDirectory(const std::string& rootDirectory) + { + boost::mutex::scoped_lock lock(mutex_); + rootDirectory_ = rootDirectory; }