1#include <thread>
2#include <cstring>
3#include <unistd.h>
4using namespace std;
5
6bool done = false;
7void foo() {
8 int x = 0;
9 for (int i = 0; i < 10000; i++)
10 x++;
11 sleep(seconds: 1);
12 for (int i = 0; i < 10000; i++)
13 x++;
14 done = true;
15}
16
17void bar() {
18 int y = 0;
19 while (!done) {
20 y++;
21 }
22 printf("bar %d\n", y);
23}
24
25int main() {
26 std::thread first(foo);
27 std::thread second(bar);
28 first.join();
29 second.join();
30
31 printf("complete\n");
32 return 0;
33
34}
35

source code of lldb/test/API/commands/trace/intelpt-multi-core-trace/multi_thread.cpp