xref: /llvm-project/lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/main.cpp (revision 55ee541653a817c77a6b5b837c4b8cc50ed3ae0e)
1 #include <chrono>
2 #include <thread>
3 #include <vector>
4 
thread_function(int my_value)5 void thread_function(int my_value) {
6   int counter = 0;
7   while (counter < 20) {
8     counter++; // Break here in thread body.
9     std::this_thread::sleep_for(std::chrono::microseconds(10));
10   }
11 }
12 
main()13 int main() {
14   std::vector<std::thread> threads;
15 
16   for (int i = 0; i < 10; i++)
17     threads.push_back(std::thread(thread_function, threads.size() + 1));
18 
19   for (std::thread &t : threads)
20     t.join();
21 
22   return 0;
23 }
24