Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerJobs/ResourceModificationJob.h @ 5130:f2dcdbe05884
ResourceModification jobs can now use multiple threads
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 05 Jan 2023 17:24:43 +0100 |
parents | 6eff25f70121 |
children | e71b22a43c0b |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.h Mon Dec 19 20:00:21 2022 +0100 +++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.h Thu Jan 05 17:24:43 2023 +0100 @@ -23,14 +23,16 @@ #pragma once #include "../../../OrthancFramework/Sources/DicomParsing/DicomModification.h" +#include "../../../OrthancFramework/Sources/MultiThreading/RunnableWorkersPool.h" #include "../DicomInstanceOrigin.h" -#include "CleaningInstancesJob.h" +#include "ThreadedSetOfInstancesJob.h" +#include <boost/thread/recursive_mutex.hpp> namespace Orthanc { class ServerContext; - class ResourceModificationJob : public CleaningInstancesJob + class ResourceModificationJob : public ThreadedSetOfInstancesJob { private: class IOutput : public boost::noncopyable @@ -49,6 +51,8 @@ class SingleOutput; class MultipleOutputs; + + mutable boost::recursive_mutex outputMutex_; std::unique_ptr<DicomModification> modification_; boost::shared_ptr<IOutput> output_; @@ -58,10 +62,10 @@ DicomTransferSyntax transferSyntax_; protected: - virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE; + virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE; // from ThreadedSetOfInstancesJob public: - explicit ResourceModificationJob(ServerContext& context); + explicit ResourceModificationJob(ServerContext& context, unsigned int workersCount); ResourceModificationJob(ServerContext& context, const Json::Value& serialized); @@ -109,10 +113,6 @@ // Only possible if "IsSingleResourceModification()" ResourceType GetOutputLevel() const; - virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE - { - } - virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE { target = "ResourceModification";