source:
CIVL/mods/dev.civl.com/examples/languageFeatures/yieldTest/local_and_yield.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 404 bytes | |
| Line | |
|---|---|
| 1 | /* Threads t0 and t1 are all wrapped in $local_begin and $local_end. |
| 2 | With $yield, both interleaves: t0 first then t1 and the other way |
| 3 | around will be explored by CIVL. Hence the assertion violation |
| 4 | will be found. |
| 5 | */ |
| 6 | |
| 7 | int x = -1; |
| 8 | |
| 9 | void thread(int tid) { |
| 10 | $local_start(); |
| 11 | $yield(); |
| 12 | x = tid; |
| 13 | $local_end(); |
| 14 | } |
| 15 | |
| 16 | int main() { |
| 17 | $parfor (int i : 0 .. 1) |
| 18 | thread(i); |
| 19 | $assert(x == 1); |
| 20 | } |
Note:
See TracBrowser
for help on using the repository browser.
