xref: /llvm-project/lldb/test/API/macosx/corefile-exception-reason/main.cpp (revision 3b14d80ad4af303c9f7df189b8b7eee528d0ec8d)
1 #include <stdlib.h>
2 #include <thread>
3 #include <unistd.h>
4 #include <vector>
5 
sleep_worker(void * in)6 void *sleep_worker(void *in) {
7   sleep(30);
8   sleep(30);
9   return nullptr;
10 }
11 
crash_worker(void * in)12 void *crash_worker(void *in) {
13   sleep(1);
14   volatile int *p = nullptr; // break here
15   return (void *)*p;
16 }
17 
main()18 int main() {
19   std::vector<std::thread> threads;
20   threads.push_back(std::move(std::thread(crash_worker, nullptr)));
21   for (int i = 0; i < 15; i++)
22     threads.push_back(std::move(std::thread(sleep_worker, nullptr)));
23   sleep(10);
24 }
25