Slots boost :: signals are called synchronously or asynchronously?

Can someone tell me that slots boost::signalsare called synchronously or asynchronously?

For example, I have this piece of code:

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();

cout << "Foo";

How does the thread of execution work? Whether waiting for execution is executed Hello()and World(), and right after that "Foo"is printed or causes them asynchronously (print "Foo" and the call Hello()and World()is performed in order undefined)?

+5
source share
2 answers
+7

"Hello World Foo", "World Hello Foo", AFAIK.

, :

sig.connect(1, World());
sig.connect(0, Hello());
0

All Articles