2 * Dekker's critical section algorithm, implemented with fences.
5 * http://www.justsoftwaresolutions.co.uk/threading/
13 std::atomic<bool> flag0, flag1;
14 std::atomic<int> turn;
20 while (flag1.load()) {
24 while (turn.load() != 0) {
42 while (flag0.load()) {
43 if (turn.load() != 1) {
45 while (turn.load() != 1) {
62 for(i=0;i<PROBLEMSIZE;i++)
68 for(i=0;i<PROBLEMSIZE;i++)
72 int user_main(int argc, char **argv)
81 thrd_create(&a, p0l, NULL);
82 thrd_create(&b, p1l, NULL);