Question

Boost.Signals is no longer being actively maintained, so it has been deprecated. Do not use Boost.Signals for new development (use Boost.Signals2 instead). If you have existing Boost.Signals-based code, it will continue to work, but consider moving to Boost.Signals2.

http://www.boost.org/users/history/version_1_54_0.html

So, Signals are deprecated. I'm confused about this. As far as I know, Signals2 is multi-threaded version of Signals. But what if I don't need multi-threading usage of Signals? Will I get some overhead? Can I use boost::signals2::trackable? Will I get any disadvantages using Signals2 in single-thread application?

Was it helpful?

Solution

As far as I know, Signals2 is multi-threaded version of Signals. But what if I don't need multi-threading usage of Signals? Will I get some overhead?

In a single-threaded environment use dummy_mutex, as described here.

Can I use boost::signals2::trackable?

Yes, you can use it, but keep in mind that it won't be thread-safe approach. So if you eventually decide to adjust your module to a mutli-threaded environment, you'll have to re-design your slots.

OTHER TIPS

Using multithread safe code in a single threaded app is always ok. You might gain some overhead due to being either overly careful or through useless locking, but it will always work. And I wouldn't worry about the performance hit- its very unlikely to be a bottleneck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top