
21 Feb
2011
21 Feb
'11
3:31 p.m.
I am looking in to using boost.signals2 for a project I’m involved in, but have a few queries:
Firstly, if I create a global signall:
boost::signals2::signal
sig; and then a structure:
struct DoWork
{
void operator()() const
{
//work.
}
If I then create a private member of a class:
DoWork work;
And then do:
Sig.connect(Work);
Will the connection happen on the thread in which the work member variable was defined or will a second thread be utilized?
Boost.Signals2 does not launch threads.
Also given that sig will be a global and hence accessed from multiple threads, do I need a mutex?
signal instance is thread-safe - in the meaning that you can connect() from one thread and signal from another, without explicit locking.