Solving issue 1684: "thumbnail.cc uses Glib::Mutex recusively" ; this changeset introduce a new MyMutex and MyMutex::MyLock class that has to be used instead of Glib ones

This commit is contained in:
Hombre
2013-08-11 23:33:10 +02:00
parent 987e4dcd89
commit f512d74323
55 changed files with 1037 additions and 751 deletions

View File

@@ -21,6 +21,7 @@
#include "thumbimageupdater.h"
#include <gtkmm.h>
#include "guiutils.h"
#include "threadutils.h"
#ifdef _OPENMP
#include <omp.h>
@@ -77,7 +78,13 @@ public:
Glib::ThreadPool* threadPool_;
// Need to be a Glib::Threads::Mutex because used in a Glib::Threads::Cond object...
// This is the only exceptions in RT so far, MyMutex is used everywhere else
#ifdef WIN32
Glib::Mutex mutex_;
#else
Glib::Threads::Mutex mutex_;
#endif
JobList jobs_;
@@ -85,7 +92,11 @@ public:
bool inactive_waiting_;
#ifdef WIN32
Glib::Cond inactive_;
#else
Glib::Threads::Cond inactive_;
#endif
void
processNextJob()
@@ -93,7 +104,11 @@ public:
Job j;
{
#ifdef WIN32
Glib::Mutex::Lock lock(mutex_);
#else
Glib::Threads::Mutex::Lock lock(mutex_);
#endif
// nothing to do; could be jobs have been removed
if ( jobs_.empty() )
@@ -168,7 +183,12 @@ public:
}
{
#ifdef WIN32
Glib::Mutex::Lock lock(mutex_);
#else
Glib::Threads::Mutex::Lock lock(mutex_);
#endif
if ( --active_ == 0 &&
inactive_waiting_ )
@@ -206,7 +226,11 @@ ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upgrade,
return;
}
#ifdef WIN32
Glib::Mutex::Lock lock(impl_->mutex_);
#else
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
#endif
// look up if an older version is in the queue
Impl::JobList::iterator i(impl_->jobs_.begin());
@@ -239,7 +263,11 @@ ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener)
{
DEBUG("removeJobs(%p)",listener);
#ifdef WIN32
Glib::Mutex::Lock lock(impl_->mutex_);
#else
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
#endif
for( Impl::JobList::iterator i(impl_->jobs_.begin()); i != impl_->jobs_.end(); )
{
@@ -271,8 +299,11 @@ ThumbImageUpdater::removeAllJobs(void)
{
DEBUG("stop");
#ifdef WIN32
Glib::Mutex::Lock lock(impl_->mutex_);
#else
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
#endif
impl_->jobs_.clear();