• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "test_utils.h"
2 int   var = 0;
3 extern "C" { // TODO: make this line empty when ignore vs. mangling is fixed.
Thread1()4 void Thread1() {
5   usleep(100000);
6   var = 1;
7 }
8 
Empty()9 void Empty() {
10 }
11 
X()12 void X() {
13   if (var) {
14     Empty();
15   }
16   var = 2;
17 }
18 
Y()19 void Y() {
20   if (var) {
21     Empty();
22   }
23   X();
24 }
25 
Thread2()26 void Thread2() {
27   Y();
28 }
29 } // TODO: make this line empty when ignore vs. mangling is fixed.
main()30 int main() {
31   ANNOTATE_TRACE_MEMORY(&var);
32   var = 0;
33   MyThread t1(Thread1, NULL, "test-thread-1");
34   MyThread t2(Thread2, NULL, "test-thread-2");
35   t1.Start();
36   t2.Start();
37   t1.Join();
38   t2.Join();
39 }
40