diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 8e69febdb..30c42a54a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -20,6 +20,7 @@ #include #include #include +#include #define CLIPTO(a,b,c) ((a)>b?((a)yield(); //the running batch should wait other threads to avoid conflict + + thread = Glib::Thread::create(sigc::mem_fun(*this, &ImProcCoordinator::process), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); + } else updaterThreadStart.unlock (); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 6b01bfe2a..03805bf82 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -29,6 +29,9 @@ #undef THREAD_PRIORITY_NORMAL +Glib::Thread *batchThread = NULL; +Glib::Mutex* qMutex = NULL; + namespace rtengine { IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl) { @@ -210,6 +213,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) { + if (!qMutex) + qMutex = new Glib::Mutex (); + + qMutex->lock(); ProcessingJob* currentJob = job; while (currentJob) { @@ -219,12 +226,22 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) { bpl->error ("Can not load input image."); currentJob = bpl->imageReady (img); } + qMutex->unlock(); } void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) { + + if (bpl) - Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, false, true, Glib::THREAD_PRIORITY_LOW); + batchThread = Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW); + + if(qMutex) + { + delete qMutex; + qMutex = NULL; + } + } } diff --git a/rtengine/simpleprocess.h b/rtengine/simpleprocess.h new file mode 100644 index 000000000..bc0675357 --- /dev/null +++ b/rtengine/simpleprocess.h @@ -0,0 +1,25 @@ +/* + * File: simpleprocess.h + * Author: askv + * + * Created on September 18, 2010, 8:31 PM + */ + +#ifndef SIMPLEPROCESS_H +#define SIMPLEPROCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + + +#ifdef __cplusplus +} +#endif + +extern Glib::Thread *batchThread; + +#endif /* SIMPLEPROCESS_H */ +