I am currently working on a reorganization of a medium-sized software product. It contains a core class similar to a kernel that is used by multiple threads. Currently, this class uses Glib::Dispatcherto process signals that are emitted by multiple threads. Since one goal of the refactoring process is to completely get rid of glibmm(since it Qtwill be used as a new structure), I am trying to figure out a way to "simulate" the functionality of a dispatcher using Boost. I have already reviewed Boost.Signalsand Boost.Signals2, but none of these libraries offer an alternative to the dispatcher.
To clarify what the dispatcher should do, here is a short description from the official documentation :
Glib :: Dispatcher works like sigc :: signal. But unlike normal signals, notification occurs asynchronously through the pipe. This is a simple and effective way to communicate between threads and is especially useful in a thread model with a single GUI thread.
No mutex lock is involved, except for the operating system internal I / O lock. This implies some rules of use:
- Only one thread can connect to the signal and receive a notification, but several senders are allowed even without blocking.
- The main GLib loop should be executed in the receiving thread (usually it will be a GUI thread).
- The Dispatcher object must be created by the receiver instance.
- Dispatcher , .
- Dispatcher .
- , , .
? , , Boost.Signals Boost.Signals2?
: , Qt . , , , , .