Frequently Asked Questions

| Home | Libraries | People | FAQ | More

## Frequently Asked Questions

1. Don't noncopyable signal semantics mean that a class with a signal member will be noncopyable as well?
2. Is Boost.Signals2 thread-safe?

1. | Don't noncopyable signal semantics mean that a class with a signal member will be noncopyable as well?
| No. The compiler will not be able to generate a copy constructor or copy assignment operator for your class if it has a signal as a member, but you are free to write your own copy constructor and/or copy assignment operator. Just don't try to copy the signal.
2. | Is Boost.Signals2 thread-safe?

Yes, as long as the Mutex template parameter is not set to a fake mutex type like `boost::signals2::dummy_mutex`. Also, if your slots depend on objects which may be destroyed concurrently with signal invocation, you will need to use automatic connection management. That is, the objects will need to be owned by `shared_ptr` and passed to the slot's `track`() method before the slot is connected. The `signals2::trackable` scheme of automatic connection management is NOT thread-safe, and is only provided to ease porting of single-threaded code from Boost.Signals to Boost.Signals2.

See the documentation section on thread-safety for more information.

Last revised: June 12, 2007 at 14:01:23 -0400 |