[clang] Fix implicit integer conversion for opaque enums declared in class templates...
[llvm-project.git] / lldb / test / API / commands / thread / backtrace / main.cpp
blob08df41b08e3444cf76fe7a7f931c945d8f369a31
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"
5 #include <thread>
7 pseudo_barrier_t g_barrier;
9 volatile int g_test = 0;
11 void stop_here() {
12 g_test += 5; // Set breakpoint here
15 void recurse_a_bit_1(int count) {
16 if (count == 50)
17 stop_here();
18 else
19 recurse_a_bit_1(++count);
22 void recurse_a_bit_2(int count) {
23 if (count == 50)
24 stop_here();
25 else
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:
34 recurse_a_bit_1(0);
36 // Return
37 return NULL;
40 void *thread_func_2() {
41 // Wait until both threads are running
42 pseudo_barrier_wait(g_barrier);
44 // Start the recursion:
45 recurse_a_bit_2(0);
47 // Return
48 return NULL;
51 int main() {
52 // Don't let either thread do anything until they're both ready.
53 pseudo_barrier_init(g_barrier, 2);
55 // Create two threads
56 std::thread thread_1(thread_func_1);
57 std::thread thread_2(thread_func_2);
59 // Wait for the threads to finish
60 thread_1.join();
61 thread_2.join();
63 return 0;