X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Fsignals.h;h=140ea014e8040d3431c0f47aaa78dcb0ac4ff584;hb=54bf06e63cee78dfa218f604d862e577d0f5754c;hp=904d51e45f472abe6a1385904f029309c7364ac5;hpb=32bed9aaf040cbd06f9855b568c14cb7a7050d58;p=ardour.git diff --git a/libs/pbd/pbd/signals.h b/libs/pbd/pbd/signals.h index 904d51e45f..140ea014e8 100644 --- a/libs/pbd/pbd/signals.h +++ b/libs/pbd/pbd/signals.h @@ -1,6 +1,6 @@ /* Copyright (C) 2009-2012 Paul Davis - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -21,13 +21,18 @@ #define __pbd_signals_h__ #include -#include +#include + +#ifdef nil +#undef nil +#endif + +#include #include #include #include #include -#include #include #include @@ -44,7 +49,7 @@ public: virtual void disconnect (boost::shared_ptr) = 0; protected: - boost::mutex _mutex; + Glib::Threads::Mutex _mutex; }; class Connection : public boost::enable_shared_from_this @@ -54,20 +59,21 @@ public: void disconnect () { - boost::mutex::scoped_lock lm (_mutex); + Glib::Threads::Mutex::Lock lm (_mutex); if (_signal) { _signal->disconnect (shared_from_this ()); - } + _signal = 0; + } } void signal_going_away () { - boost::mutex::scoped_lock lm (_mutex); + Glib::Threads::Mutex::Lock lm (_mutex); _signal = 0; } private: - boost::mutex _mutex; + Glib::Threads::Mutex _mutex; SignalBase* _signal; }; @@ -109,6 +115,11 @@ public: ScopedConnection& operator= (UnscopedConnection const & o) { + if (_c == o) { + return *this; + } + + disconnect (); _c = o; return *this; } @@ -141,7 +152,7 @@ class ScopedConnectionList : public boost::noncopyable one from another. */ - Glib::Mutex _lock; + Glib::Threads::Mutex _lock; typedef std::list ConnectionList; ConnectionList _list;