Class auto_threaded

boost::signalslib::auto_threaded — Automatically enabled/disabled thread-safety for a signal.

Synopsis

class auto_threaded {
};

Description

The auto_threaded class will produce a thread-safe signal class when used as a signal's ThreadingModel template parameter if and only if boost has detected thread support in the compiler's current translation mode. The header file boost/config.hpp defines the macro BOOST_HAS_THREADS when boost detects threading support. The user may globally disable thread support in boost by defining BOOST_DISABLE_THREADS before any boost header files are included.

When in thread-safe mode, the auto_threaded class uses a header-only mutex implementation. Thus, it has no dependence on the boost.threads library. If you are already using boost.threads, you may prefer to use the boost::signalslib::multi_threaded ThreadingModel, which uses a mutex class provided by boost.threads.

You may wish to use a thread-unsafe signal in a multi-threaded program, if the signal is only used by a single thread. In that case, you may prefer to use the boost::signalslib::single_threaded class as your ThreadingModel.