projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into cairocanvas
[ardour.git]
/
libs
/
pbd
/
pbd
/
signals.h
diff --git
a/libs/pbd/pbd/signals.h
b/libs/pbd/pbd/signals.h
index 904d51e45f472abe6a1385904f029309c7364ac5..140ea014e8040d3431c0f47aaa78dcb0ac4ff584 100644
(file)
--- a/
libs/pbd/pbd/signals.h
+++ b/
libs/pbd/pbd/signals.h
@@
-1,6
+1,6
@@
/*
Copyright (C) 2009-2012 Paul Davis
/*
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
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 <list>
#define __pbd_signals_h__
#include <list>
-#include <glibmm/thread.h>
+#include <map>
+
+#ifdef nil
+#undef nil
+#endif
+
+#include <glibmm/threads.h>
#include <boost/noncopyable.hpp>
#include <boost/bind.hpp>
#include <boost/bind/protect.hpp>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <boost/bind.hpp>
#include <boost/bind/protect.hpp>
#include <boost/function.hpp>
-#include <boost/thread/mutex.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/optional.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/optional.hpp>
@@
-44,7
+49,7
@@
public:
virtual void disconnect (boost::shared_ptr<Connection>) = 0;
protected:
virtual void disconnect (boost::shared_ptr<Connection>) = 0;
protected:
-
boost::m
utex _mutex;
+
Glib::Threads::M
utex _mutex;
};
class Connection : public boost::enable_shared_from_this<Connection>
};
class Connection : public boost::enable_shared_from_this<Connection>
@@
-54,20
+59,21
@@
public:
void disconnect ()
{
void disconnect ()
{
-
boost::mutex::scoped_l
ock lm (_mutex);
+
Glib::Threads::Mutex::L
ock lm (_mutex);
if (_signal) {
_signal->disconnect (shared_from_this ());
if (_signal) {
_signal->disconnect (shared_from_this ());
- }
+ _signal = 0;
+ }
}
void signal_going_away ()
{
}
void signal_going_away ()
{
-
boost::mutex::scoped_l
ock lm (_mutex);
+
Glib::Threads::Mutex::L
ock lm (_mutex);
_signal = 0;
}
private:
_signal = 0;
}
private:
-
boost::m
utex _mutex;
+
Glib::Threads::M
utex _mutex;
SignalBase* _signal;
};
SignalBase* _signal;
};
@@
-109,6
+115,11
@@
public:
ScopedConnection& operator= (UnscopedConnection const & o)
{
ScopedConnection& operator= (UnscopedConnection const & o)
{
+ if (_c == o) {
+ return *this;
+ }
+
+ disconnect ();
_c = o;
return *this;
}
_c = o;
return *this;
}
@@
-141,7
+152,7
@@
class ScopedConnectionList : public boost::noncopyable
one from another.
*/
one from another.
*/
- Glib::Mutex _lock;
+ Glib::
Threads::
Mutex _lock;
typedef std::list<ScopedConnection*> ConnectionList;
ConnectionList _list;
typedef std::list<ScopedConnection*> ConnectionList;
ConnectionList _list;