Get data race detector working... Commented out function call code since it crashes...
[c11tester.git] / context.cc
1 #include "context.h"
2
3 #ifdef MAC
4
5 int model_swapcontext(ucontext_t *oucp, ucontext_t *ucp)
6 {
7         /*
8          * Mac OSX swapcontext() clobbers some registers, so use a hand-rolled
9          * version with {get,set}context(). We can avoid the same problem
10          * (where optimizations can break the following code) because we don't
11          * statically link with the C library
12          */
13
14         /* volatile, so that 'i' doesn't get promoted to a register */
15         volatile int i = 0;
16
17         getcontext(oucp);
18
19         if (i == 0) {
20                 i = 1;
21                 setcontext(ucp);
22         }
23
24         return 0;
25 }
26
27 #endif  /* MAC */