/*
- 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
#include "pbd/libpbd_visibility.h"
#include "pbd/event_loop.h"
+#ifndef NDEBUG
#define DEBUG_PBD_SIGNAL_CONNECTIONS
+#endif
#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
#include "pbd/stacktrace.h"
class LIBPBD_API SignalBase
{
public:
- SignalBase () : _debug_connection (false) {}
+ SignalBase ()
+#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
+ : _debug_connection (false)
+#endif
+ {}
virtual ~SignalBase () {}
virtual void disconnect (boost::shared_ptr<Connection>) = 0;
#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
return r;
}
};
-
+
typedef boost::shared_ptr<Connection> UnscopedConnection;
-
+
class LIBPBD_API ScopedConnection
{
public:
if (_c == o) {
return *this;
}
-
+
disconnect ();
_c = o;
return *this;
private:
UnscopedConnection _c;
};
-
+
class LIBPBD_API ScopedConnectionList : public boost::noncopyable
{
public:
ScopedConnectionList();
virtual ~ScopedConnectionList ();
-
+
void add_connection (const UnscopedConnection& c);
void drop_connections ();
scoped connections needs to be protected in 2 cases:
(1) (unlikely) we make a connection involving a callback on the
- same object from 2 threads. (wouldn't that just be appalling
+ same object from 2 threads. (wouldn't that just be appalling
programming style?)
-
+
(2) where we are dropping connections in one thread and adding
one from another.
*/
ConnectionList _list;
};
-#include "pbd/signals_generated.h"
-
+#include "pbd/signals_generated.h"
+
} /* namespace */
#endif /* __pbd_signals_h__ */