Changes in tests/concurrent/sleep.cfa [7bd23ce:c457dc4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/sleep.cfa
r7bd23ce rc457dc4 7 7 } 8 8 9 volatile int counter = 0;10 11 9 thread fast_sleeper {}; 12 10 void main(fast_sleeper &) { … … 14 12 for(i; 20) { 15 13 sleep(wait); 16 __atomic_fetch_add( &counter, 1, __ATOMIC_RELAXED);14 sout | acquire | "fast loop" | ((1 + i) * wait); 17 15 } 18 16 } … … 22 20 Duration wait = 277`ms; 23 21 for(i; 4) { 22 24 23 sleep(wait); 25 int val = __atomic_add_fetch( &counter, -5, __ATOMIC_RELAXED ); 26 if(val < -9) abort | "Value reached negative value:" | val; 24 sout | acquire | "slow loop" | ((1 + i) * wait); 27 25 } 28 26 }
Note: See TracChangeset
for help on using the changeset viewer.