1 #include <thread> 2 #include <chrono> 3 usleep_helper(unsigned int usec)4void 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)9void *background_thread(void *arg) { 10 (void) arg; 11 for (;;) { 12 usleep_helper(2); 13 } 14 } 15 main(void)16int 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