xref: /llvm-project/lldb/test/API/commands/gui/expand-threads-tree/main.cpp (revision 791b6ebc86680168d634103b67a92a354c075cc4)
1*791b6ebcSPavel Labath #include "pseudo_barrier.h"
2*791b6ebcSPavel Labath #include <thread>
3*791b6ebcSPavel Labath 
4*791b6ebcSPavel Labath 
5*791b6ebcSPavel Labath pseudo_barrier_t barrier_before;
6*791b6ebcSPavel Labath pseudo_barrier_t barrier_after;
7*791b6ebcSPavel Labath 
break_here()8*791b6ebcSPavel Labath void break_here() {}
9*791b6ebcSPavel Labath 
thread_func()10*791b6ebcSPavel Labath void thread_func() {
11*791b6ebcSPavel Labath     pseudo_barrier_wait(barrier_before);
12*791b6ebcSPavel Labath     break_here();
13*791b6ebcSPavel Labath     pseudo_barrier_wait(barrier_after);
14*791b6ebcSPavel Labath }
15*791b6ebcSPavel Labath 
main()16*791b6ebcSPavel Labath int main() {
17*791b6ebcSPavel Labath   pseudo_barrier_init(barrier_before, 2);
18*791b6ebcSPavel Labath   pseudo_barrier_init(barrier_after, 2);
19*791b6ebcSPavel Labath   std::thread thread(thread_func);
20*791b6ebcSPavel Labath   pseudo_barrier_wait(barrier_before);
21*791b6ebcSPavel Labath   pseudo_barrier_wait(barrier_after);
22*791b6ebcSPavel Labath   thread.join();
23*791b6ebcSPavel Labath   return 0;
24*791b6ebcSPavel Labath }
25