1 | // Test simulates situation when suspended thread could stop process |
2 | // where thread that is a real reason of stop says process |
3 | // should not stop in it's action handler. |
4 | |
5 | #include <chrono> |
6 | #include <thread> |
7 | |
8 | void thread1() { |
9 | // Will be suspended at breakpoint stop |
10 | // Set first breakpoint here |
11 | } |
12 | |
13 | void thread2() { |
14 | /* |
15 | Prevent threads from stopping simultaneously |
16 | */ |
17 | std::this_thread::sleep_for(rtime: std::chrono::seconds(1)); |
18 | // Set second breakpoint here |
19 | } |
20 | |
21 | int main() { |
22 | // Create a thread |
23 | std::thread thread_1(thread1); |
24 | |
25 | // Create another thread. |
26 | std::thread thread_2(thread2); |
27 | |
28 | // Wait for the thread that was not suspeneded |
29 | thread_2.join(); |
30 | |
31 | // Wait for thread that was suspended |
32 | thread_1.join(); // Set third breakpoint here |
33 | |
34 | return 0; |
35 | } |
36 | |