[Boost.Thread] thread started after constructor

20 Oct
2011
20 Oct
'11
2:57 p.m.
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? }

20 Oct
20 Oct
3:09 p.m.
...sorry stupid question. Even if it is started it doesn't guarantee that next instruction in thread function is executed. One always need a form of synchronization for guarantees.
4931
Age (days ago)
4931
Last active (days ago)
1 comments
1 participants
participants (1)
-
gast128