1 | #include "pseudo_barrier.h" |
---|---|
2 | #include <thread> |
3 | |
4 | |
5 | pseudo_barrier_t barrier_before; |
6 | pseudo_barrier_t barrier_after; |
7 | |
8 | void break_here() {} |
9 | |
10 | void thread_func() { |
11 | pseudo_barrier_wait(barrier_before); |
12 | break_here(); |
13 | pseudo_barrier_wait(barrier_after); |
14 | } |
15 | |
16 | int main() { |
17 | pseudo_barrier_init(barrier_before, 2); |
18 | pseudo_barrier_init(barrier_after, 2); |
19 | std::thread thread(thread_func); |
20 | pseudo_barrier_wait(barrier_before); |
21 | pseudo_barrier_wait(barrier_after); |
22 | thread.join(); |
23 | return 0; |
24 | } |
25 |