Changeset 7bd23ce for tests/concurrent/sleep.cfa
- Timestamp:
- May 27, 2021, 2:39:35 PM (2 years ago)
- Branches:
- ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- cece53c
- Parents:
- ab388c5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/sleep.cfa
rab388c5 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.