1 // This test is intended to create a situation in which two threads are stopped
2 // at a breakpoint and the debugger issues a step-out command.
4 #include "pseudo_barrier.h"
7 pseudo_barrier_t g_barrier
;
9 volatile int g_test
= 0;
12 g_test
+= 5; // Set breakpoint here
15 void recurse_a_bit_1(int count
) {
19 recurse_a_bit_1(++count
);
22 void recurse_a_bit_2(int count
) {
26 recurse_a_bit_2(++count
);
29 void *thread_func_1() {
30 // Wait until both threads are running
31 pseudo_barrier_wait(g_barrier
);
33 // Start the recursion:
40 void *thread_func_2() {
41 // Wait until both threads are running
42 pseudo_barrier_wait(g_barrier
);
44 // Start the recursion:
52 // Don't let either thread do anything until they're both ready.
53 pseudo_barrier_init(g_barrier
, 2);
56 std::thread
thread_1(thread_func_1
);
57 std::thread
thread_2(thread_func_2
);
59 // Wait for the threads to finish