| 92 | | We denotes Ax as thread x executes statement A. |
| 93 | | Assuming there are two threads 0 and 1, |
| 94 | | the first $check_data_race() checks races between: |
| 95 | | |
| 96 | | A0,A1; A0,B1; A1,B0; B0,C1; B1,C0; |
| 97 | | |
| 98 | | Then, the second $check_data_race() checks races between: |
| 99 | | |
| 100 | | A0,C1; A1,C0; C0,C1; |
| 101 | | |
| 102 | | Races between B0 and B1 are disabled, because B is in critical block. |
| | 94 | We denotes that thread x executes statement A as Ax. |
| | 95 | Assuming there are two threads 0 and 1, two traces shall be explored: |
| | 96 | |
| | 97 | Trace1: A0y0 A1y1 B0cdr0C0cdr0 B1cdr1C1cdr1; |
| | 98 | |
| | 99 | Trace2: A0y0 A1y1 B1cdr1C1cdr1 B0cdr0C0cdr0; |
| | 100 | |
| | 101 | For the first trace, cdr0 following B0 checks data races between |
| | 102 | |
| | 103 | A0 and A1; |
| | 104 | B0 and A1; |
| | 105 | |
| | 106 | Then, w/r sets on thread 0 is cleaned. |
| | 107 | |
| | 108 | The second cdr0 following C0 checks data races between |
| | 109 | |
| | 110 | C0 and A1; |
| | 111 | |
| | 112 | An implicit barrier is placed at the end after the second cdr0, |
| | 113 | thus thread 1 starts executing its remaining part. |
| | 114 | The first cdr1 checks data races between |
| | 115 | |
| | 116 | C0 and A1; |
| | 117 | C0 and B1; |
| | 118 | |
| | 119 | Then, tracked sets on both A1 and B1 are cleaned. |
| | 120 | |
| | 121 | Finally, the last cdr1 in the first trace checks data races between |
| | 122 | |
| | 123 | C0 and C1; |
| | 124 | |
| | 125 | The second trace will complete checking by performing checks between |
| | 126 | |
| | 127 | B1 and A0 |
| | 128 | C1 and A0 |
| | 129 | C1 and B0 |
| | 130 | |
| | 131 | Because B is protected by critical section, races between B0 and B1 are not checked. |
| | 132 | As a result, all required pairs are checked. |
| | 133 | |