change PBD::Transmitter code to use PBD::Signal<> not sigc::signal<>, since the latter is not thread safe
This commit is contained in:
parent
f77d1e0a36
commit
09ed9c44e7
|
@ -42,7 +42,7 @@ class LIBPBD_API Receiver : public sigc::trackable
|
||||||
virtual void receive (Transmitter::Channel, const char *) = 0;
|
virtual void receive (Transmitter::Channel, const char *) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<sigc::connection *> connections;
|
PBD::ScopedConnectionList connections;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __libmisc_receiver_h__
|
#endif // __libmisc_receiver_h__
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <sigc++/sigc++.h>
|
#include <pbd/signals.h>
|
||||||
|
|
||||||
#include "pbd/libpbd_visibility.h"
|
#include "pbd/libpbd_visibility.h"
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class LIBPBD_API Transmitter : public std::stringstream
|
||||||
|
|
||||||
Transmitter (Channel);
|
Transmitter (Channel);
|
||||||
|
|
||||||
sigc::signal<void,Channel, const char *> &sender() {
|
PBD::Signal2<void,Channel, const char *> &sender() {
|
||||||
return *send;
|
return *send;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +53,12 @@ class LIBPBD_API Transmitter : public std::stringstream
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Channel channel;
|
Channel channel;
|
||||||
sigc::signal<void, Channel, const char *> *send;
|
PBD::Signal2<void, Channel, const char *> *send;
|
||||||
|
|
||||||
sigc::signal<void, Channel, const char *> info;
|
PBD::Signal2<void, Channel, const char *> info;
|
||||||
sigc::signal<void, Channel, const char *> warning;
|
PBD::Signal2<void, Channel, const char *> warning;
|
||||||
sigc::signal<void, Channel, const char *> error;
|
PBD::Signal2<void, Channel, const char *> error;
|
||||||
sigc::signal<void, Channel, const char *> fatal;
|
PBD::Signal2<void, Channel, const char *> fatal;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* for EGCS 2.91.66, if this function is not compiled within the same
|
/* for EGCS 2.91.66, if this function is not compiled within the same
|
||||||
|
|
|
@ -37,23 +37,17 @@ Receiver::~Receiver ()
|
||||||
void
|
void
|
||||||
Receiver::hangup ()
|
Receiver::hangup ()
|
||||||
{
|
{
|
||||||
vector<sigc::connection *>::iterator i;
|
connections.drop_connections ();
|
||||||
|
|
||||||
for (i = connections.begin(); i != connections.end (); i++) {
|
|
||||||
(*i)->disconnect ();
|
|
||||||
delete *i;
|
|
||||||
}
|
|
||||||
|
|
||||||
connections.erase (connections.begin(), connections.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Receiver::listen_to (Transmitter &transmitter)
|
Receiver::listen_to (Transmitter &transmitter)
|
||||||
|
|
||||||
{
|
{
|
||||||
sigc::connection *c = new sigc::connection;
|
/* odd syntax here because boost's placeholders (_1, _2) are in an
|
||||||
|
anonymous namespace which causes ambiguity with sigc++ (and will also
|
||||||
|
do so with std::placeholder in the C++11 future
|
||||||
|
*/
|
||||||
|
transmitter.sender().connect_same_thread (connections, boost::bind (&Receiver::receive, this, boost::arg<1>(), boost::arg<2>()));
|
||||||
|
|
||||||
(*c) = transmitter.sender().connect(mem_fun(*this, &Receiver::receive));
|
|
||||||
|
|
||||||
connections.push_back (c);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user