source:
CIVL/mods/dev.civl.com/examples/languageFeatures/yieldTest/yield_purely_local.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 319 bytes | |
| Line | |
|---|---|
| 1 | /* Both threads have no access to the shared object hence the $yield |
| 2 | is a no-op. Otherwise, this test can run for an unendurable time. |
| 3 | */ |
| 4 | |
| 5 | int x = -1; |
| 6 | |
| 7 | void thread(int tid) { |
| 8 | int x; |
| 9 | |
| 10 | for (int i = 0; i < 100; i++) { |
| 11 | x = tid; |
| 12 | $yield(); |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | int main() { |
| 17 | $parfor (int i : 0 .. 4) |
| 18 | thread(i); |
| 19 | } |
Note:
See TracBrowser
for help on using the repository browser.
