Boost logo

Boost Users :

Subject: [Boost-users] [Boost.Thread] thread started after constructor
From: gast128 (gast128_at_[hidden])
Date: 2011-10-20 10:57:54


Hello all,

I have a basic question about threads: can one assume that the thread is started
after the constructor call (or when using create_thread in thread groups) or
does one has to use an extra synchronization primitive (e.g. a barrier)?

Example (real world is more complex):

void g(int* x)
{
  int x1 = *x;
}

void f()
{
   int x = 0;
   boost::thread thd(&g, &x);
   //<-- thread is started or not?
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net