[boost.signals2] queries

Hi:
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

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.

Thanks just what I needed! Cheers Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Igor R Sent: 21 February 2011 15:32 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.signals2] queries
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. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Igor R
-
Sean Farrow