26 #include <core/threading/thread.h> 27 #include <core/threading/barrier.h> 35 class ExampleBarrierThread :
public Thread 38 ExampleBarrierThread(
string pp,
39 Barrier *barrier,
unsigned int sleep_time)
40 :
Thread(
"ExampleBarrierThread",
Thread::OPMODE_CONTINUOUS)
43 this->barrier = barrier;
44 this->sleep_time = sleep_time;
50 cout << pp <<
": Waiting for barrier" << endl;
52 cout << pp <<
": Barrier lifted" << endl;
57 unsigned int sleep_time;
64 main(
int argc,
char **argv)
68 ExampleBarrierThread *t1 =
new ExampleBarrierThread(
"t1", b, 3424345);
69 ExampleBarrierThread *t2 =
new ExampleBarrierThread(
"t2", b, 326545);
70 ExampleBarrierThread *t3 =
new ExampleBarrierThread(
"t3", b, 6458642);
Fawkes library namespace.
Thread class encapsulation of pthreads.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...