I have gone through similar questions on Stackoverflow but still can't get a good answer:
I am quite puzzled on how this signal/slot is achieved.
Q1: From the following code, sig is connected to two function(Hello() and World()), and it seems that the functions are called in a serialized manner, which also implies that, one function(Hello()) need to be completed before going into another function(World())? => Single thread program
Q2: Are there anyway to enable multi-threaded signal/slot?(=> World() will start instantly, don't need to wait for Hello() to complete.) Or if it's not recommended, would you mind tell me why?
Sample codes on Boost website:
struct Hello
{
void operator()() const { std::cout << "Hello";}
};
struct World
{
void operator()() const { std::cout << ", World!" << std::endl;}
};
boost::signal<void ()> sig;
sig.connect(Hello());
sig.connect(World());
sig();
Output: Hello, World!