Questions tagged [boost-signals2]

The Boost.Signals2 library is a thread-safe C++ implementation of a managed signals and slots system.

The Boost.Signals2 library is a thread-safe C++ implementation of a managed signals and slots system. Signals represent callbacks with multiple targets, and are also called publishers or events in similar systems. Signals are connected to some set of slots, which are callback receivers (also called event targets or subscribers), which are called when the signal is "emitted."

Signals and slots are managed, in that signals and slots (or, more properly, objects that occur as part of the slots) can track connections and are capable of automatically disconnecting signal/slot connections when either is destroyed. This enables the user to make signal/slot connections without expending a great effort to manage the lifetimes of those connections with regard to the lifetimes of all objects involved.

When signals are connected to multiple slots, there is a question regarding the relationship between the return values of the slots and the return value of the signals. Boost.Signals2 allows the user to specify the manner in which multiple return values are combined.

109 questions
28
votes
1 answer

How and why one would use Boost signals2?

Learning c++ and trying to get familiar with some patterns. The signals2 doc clearly has a vast array of things I can do with slots and signals. What I don't understand is what types of applications (use cases) I should use it for. I'm thinking…
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
12
votes
5 answers

Force deletion of slot in boost::signals2

I have found that boost::signals2 uses sort of a lazy deletion of connected slots, which makes it difficult to use connections as something that manages lifetimes of objects. I am looking for a way to force slots to be deleted directly when…
villintehaspam
  • 8,540
  • 6
  • 45
  • 76
10
votes
1 answer

Visual Studio 2012 C++ compile error with Boost Signal2

I am using Visual Studio 2012 Ultimate with the following Boost Signals2 code: at https://github.com/cfobel/boost_signals2/blob/master/hello_world_0.cpp It generates the following error: c:\program files (x86)\microsoft visual studio…
heavy rocker dude
  • 2,271
  • 8
  • 33
  • 47
7
votes
2 answers

Is boost::signals2 overkill for simple applications?

In an environment restricted to C++03,boost::signals2 was used alongside boost::function and boost::bind to implement a simple messaging system between components. It works great and I have no problems with it whatsoever. However, in another…
OMGtechy
  • 7,935
  • 8
  • 48
  • 83
7
votes
1 answer

boost::signals2 slot as a non-static function member?

I have been playing around with boost::signals2 for learning purposes lately, and I was wondering whether I could connect signals to a non-static slot located within a class (like I could in Qt). Consider the following: class Worker { typedef…
nikolas
  • 8,707
  • 9
  • 50
  • 70
6
votes
2 answers

Replacing boost-signals2 with C++11 signals

I'm a research programmer developing autonomy systems for unmanned vehicles and I'm in the middle of modifying some open source code from another project to make a driver for vehicle control. The idea is to have a module that generally handles…
6
votes
2 answers

Signals and threads - good or bad design decision?

I have to write a program that performs highly computationally intensive calculations. The program might run for several days. The calculation can be separated easily in different threads without the need of shared data. I want a GUI or a web…
Jens
  • 156
  • 1
  • 5
6
votes
1 answer

clang doesn't like boost::signals2?

All day I kept on getting compiler errors from parts of code using the Boost::Signals2 library. I've reduced what I'm trying to do to a minimal example: #include int foo(); struct first_nonzero { using result_type = int; …
nikolas
  • 8,707
  • 9
  • 50
  • 70
6
votes
2 answers

How are signal signatures in `boost::signals2` implemented?

I have been using boost::signals2 for some time now in my projects. To my shame, I still do not understand how they are implemented under the hood. My problems already start at the very definition of a signal. How is a definition such…
Gnosophilon
  • 1,340
  • 7
  • 24
5
votes
1 answer

Is there an existing way to serialize invocations of a boost::signals2 signal?

I would like to serialize multithreaded invocations of a boost::signals2 signal in order to make sure that notifications about state changes from an object arrive at slots in a well defined order. Background I have an object with an internal state…
villintehaspam
  • 8,540
  • 6
  • 45
  • 76
5
votes
1 answer

How can I store and forward slots using boost::signals2?

I have a problem where I'm having to instantiate instances of objects earlier than I would like to do so because I need to connect signal slots through some deep ownership, and I'd like to come up with a way of storing and forwarding the slots so…
Austin Ziegler
  • 776
  • 10
  • 17
5
votes
1 answer

boost::signals2 and exception handling

Is there some way to override the specific moment when a slot is called in boost::signals2 and perform some actions (logging, debugging, exception handling)? I would like to catch exceptions at the moment of slot invocations, because signals/slots…
integer
  • 1,075
  • 7
  • 12
4
votes
2 answers

Does the boost.signals2 library need to be built?

My system is having trouble building the boost libraries. I understand that most boost libraries are (fortunately) just headers that do not need to be build (with some exceptions). Does the boost :: signals2 library need to be built? Also is the…
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
4
votes
1 answer

Is it possible to create boost::signal2 with asynchronous combiner?

For a project, I try to create asynchronous boost signals, it seems to work, but valgrind tells me the opposite. In the following example you can see a basic implementation and usage. For this example I need an asynchronous signal because, signal is…
Fafesty
  • 43
  • 5
4
votes
2 answers

Handle connection/disconnection of many signals/slots with boost::signals2

I've started using boost::signals2 instead of my old signals-code. I'm having a problem with administering multiple connections though. Here's my problem: I have many instances of the class Person: class Person { public: void SetName (string…
Jonatan
  • 3,752
  • 4
  • 36
  • 47
1
2 3 4 5 6 7 8