Changeset b984d54 for tests/unified_locking
- Timestamp:
- May 25, 2021, 4:13:37 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c65b930
- Parents:
- 7404cdc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/unified_locking/timeout_lock.cfa
r7404cdc rb984d54 6 6 #include "kernel.cfa" 7 7 8 multiple_acquisition_lock m; 9 condition_variable( multiple_acquisition_lock ) c_m; 10 11 semaphore s; // used for barrier like behaviour 8 multiple_acquisition_lock m, n; 9 condition_variable( multiple_acquisition_lock ) c_m, c_n; 12 10 13 11 const unsigned int NoOfTimes = 20; 14 12 15 void block() { 16 if (s.count == 0) { 17 P(s); 13 void block() { // used for barrier like behaviour 14 lock(n); 15 if (empty( c_n )) { 16 wait( c_n, n ); 18 17 } else { 19 V(s);18 notify_one( c_n ); 20 19 } 20 unlock(n); 21 21 } 22 22 … … 80 80 81 81 printf("Start Test 2: testing timeout vs signalling with varying timeout durations\n"); 82 s{ 0 };83 82 { 84 83 T1 t1;
Note: See TracChangeset
for help on using the changeset viewer.