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