12

I have application that may benefit from using one of boost's signals libraries over a homegrown solution.

The application is multithreaded but the part that does the signal processing is single threaded.

Is there any reason to prefer Boost.Signals2 over Boost.Signal if multithreading is not an issue?

deft_code
  • 57,255
  • 29
  • 141
  • 224
  • 1
    Make sure you consider [libtscb](http://www.chaoticmind.net/~hcb/projects/libtscb/) as well -- its [performance comparisons](http://www.chaoticmind.net/~hcb/projects/libtscb/doc/index.html#performance) are especially noteworthy. – ildjarn Nov 01 '11 at 17:01
  • @ildjarn: unfortunately the libtscb requires GCC. I don't know about the rest of library, but the atomics are only implemented for GCC. Once Visual Studio gets C++11 `std::atomic` it could be trivially ported. – deft_code Nov 01 '11 at 17:35
  • Another option is to use the currently-under-review [Boost.Atomics](http://www.chaoticmind.net/~hcb/projects/boost.atomic/doc/index.html) :-] – ildjarn Nov 01 '11 at 18:08
  • 3
    Also, if you've not already seen it, the Signal2 docs already lists the major changes from Signals, including enhanced or removed functionality not related to thread-safety: [Signals2 API Changes](http://www.boost.org/doc/html/signals2/api_changes.html) – ildjarn Nov 01 '11 at 18:27
  • Another library to consider might be Sarah Thompson's Sigslots: http://sigslot.sourceforge.net – Tomas Andrle Dec 13 '12 at 15:22

2 Answers2

10

Boost.Signals is now deprecated, and Boost.Signals2 should be used instead (see v1.54 docs)

Paulo
  • 757
  • 8
  • 18
  • 3
    To quote an important note on that page (for convenience): "**Boost.Signals is no longer being actively maintained. 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. There is a porting guide in the Signals2 documentation." – Cornstalks Aug 24 '13 at 02:06
  • And to be honest, most of the times, when you start using a nice feature, you'll end up wanting to use it at some other places than where it was first desired. – Vaillancourt Dec 18 '13 at 19:54
5

Originally, if all the signals and slots were in the same thread, boost.signals was just fine. However, it is no longer being maintained -- the documentation suggests using signals2 in all new code.

Nathan Monteleone
  • 5,430
  • 29
  • 43