xref: /llvm-project/lldb/test/API/functionalities/breakpoint/two_hits_one_actual/main.cpp (revision b8e0b5a071600cb39d938470bd20d845013384ce)
1 #include <thread>
2 #include <chrono>
3 
usleep_helper(unsigned int usec)4 void usleep_helper(unsigned int usec) {
5   // Break here in the helper
6   std::this_thread::sleep_for(std::chrono::duration<unsigned int, std::milli>(usec));
7 }
8 
background_thread(void * arg)9 void *background_thread(void *arg) {
10     (void) arg;
11     for (;;) {
12         usleep_helper(2);
13     }
14 }
15 
main(void)16 int main(void) {
17   unsigned int main_usec = 1;
18   std::thread main_thread(background_thread, nullptr); // Set bkpt here to get started
19   for (;;) {
20     usleep_helper(main_usec);
21   }
22 }
23