Changeset d923fca for tests/concurrency/waituntil
- Timestamp:
- Feb 18, 2025, 12:54:23 PM (8 months ago)
- Branches:
- master
- Children:
- 8705a11
- Parents:
- 3e5fea2
- Location:
- tests/concurrency/waituntil
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/waituntil/all_types.cfa
r3e5fea2 rd923fca 33 33 34 34 thread Server1 {}; 35 void main( Server1 & this) {36 long long int a, b,c, i = 0, myTotal = 0;35 void main( Server1 & ) { 36 long long int a, c, i = 0, myTotal = 0; 37 37 for( ;;i++ ) { 38 38 when( i % 2 == 0 ) waituntil( a << A ) { myTotal += a; } … … 46 46 47 47 thread Drainer {}; // ensures that the changing when states of Server1 don't result in a deadlock 48 void main( Drainer & this) {49 long long int a, b,c, myTotal = 0;48 void main( Drainer & ) { 49 long long int a, c, myTotal = 0; 50 50 for( ;; ) { 51 51 waituntil( F ) { myTotal += get(F); reset( F ); } … … 59 59 60 60 thread Churner {}; // performs non-waituntil try insert/remove operations to add churn/interference 61 void main( Churner & this) {61 void main( Churner & ) { 62 62 long long int out, myTotal = 0; 63 63 bool success; -
tests/concurrency/waituntil/channel_close.cfa
r3e5fea2 rd923fca 9 9 10 10 thread Producer {}; 11 void main( Producer & this) {11 void main( Producer & ) { 12 12 try { 13 13 for( size_t i; 0~@ ) { … … 15 15 and waituntil( B << i ) { inserts++; } 16 16 } 17 } catch ( channel_closed * e ) {} 17 } catch ( channel_closed * e ) {} 18 18 } 19 19 20 20 bool useAnd = false; 21 21 thread Consumer {}; // ensures that the changing when states of Server1 don't result in a deadlock 22 void main( Consumer & this) {22 void main( Consumer & ) { 23 23 ssize_t in, in2, A_removes = 0, B_removes = 0; 24 24 … … 34 34 } 35 35 } catchResume ( channel_closed * e ) { // continue to remove until would block 36 } catch ( channel_closed * e ) {} 36 } catch ( channel_closed * e ) {} 37 37 38 38 try { … … 40 40 waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; } 41 41 } catchResume ( channel_closed * e ) { // continue to remove until would block 42 } catch ( channel_closed * e ) {} 42 } catch ( channel_closed * e ) {} 43 43 44 44 try { … … 46 46 waituntil( (in << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( B_removes == in ); B_removes++; removes++; } 47 47 } catchResume ( channel_closed * e ) { // continue to remove until would block 48 } catch ( channel_closed * e ) {} 48 } catch ( channel_closed * e ) {} 49 49 } 50 50 -
tests/concurrency/waituntil/channels.cfa
r3e5fea2 rd923fca 9 9 10 10 thread Server1 {}; 11 void main( Server1 & this) {11 void main( Server1 & ) { 12 12 long long int a, b, c, i = 0, myTotal = 0; 13 13 for( ;;i++ ) { … … 21 21 22 22 thread Drainer {}; // ensures that the changing when states of Server1 don't result in a deadlock 23 void main( Drainer & this) {23 void main( Drainer & ) { 24 24 long long int a, b, c, myTotal = 0; 25 25 for( ;; ) { … … 33 33 34 34 thread Churner {}; // performs non-waituntil try insert/remove operations to add churn/interference 35 void main( Churner & this) {35 void main( Churner & ) { 36 36 long long int out, myTotal = 0; 37 37 bool success; -
tests/concurrency/waituntil/futures.cfa
r3e5fea2 rd923fca 8 8 9 9 thread Server1 {}; 10 void main( Server1 & this) {10 void main( Server1 & ) { 11 11 fulfil(B, 3); 12 12 P( s ); … … 16 16 17 17 thread Server2 {}; 18 void main( Server2 & this) {18 void main( Server2 & ) { 19 19 fulfil(B, 6); 20 20 fulfil(A, 5); -
tests/concurrency/waituntil/locks.cfa
r3e5fea2 rd923fca 12 12 13 13 thread Server1 {}; 14 void main( Server1 & this) {14 void main( Server1 & ) { 15 15 while( !done ) { 16 16 lock(A); … … 44 44 ) 45 45 and when( i < 4 ) waituntil( C ) { c++; } 46 46 47 47 when( i % 2 == 0 ) waituntil( A ) { a++; } 48 48 and when( i % 4 < 2 ) waituntil( B ) { b++; } -
tests/concurrency/waituntil/repeat_close.cfa
r3e5fea2 rd923fca 10 10 11 11 thread Producer {}; 12 void main( Producer & this ) { 13 long long int my_inserts = 0; 12 void main( Producer & ) { 14 13 long long int A_i = 0, B_i = 0, C_i = 0, D_i = 0, E_i = 0, F_i = 0; 15 14 try { … … 22 21 and waituntil( F << i ) { F_i++; } 23 22 } 24 } catch ( channel_closed * e ) {} 23 } catch ( channel_closed * e ) {} 25 24 __atomic_fetch_add( &inserts, A_i + B_i + C_i + D_i + E_i + F_i, __ATOMIC_SEQ_CST ); 26 25 } 27 26 28 27 thread Consumer {}; 29 void main( Consumer & this) {28 void main( Consumer & ) { 30 29 long long int in, A_removes = 0, B_removes = 0, C_removes = 0, D_removes = 0, E_removes = 0, F_removes = 0; 31 30 try { … … 83 82 printf("Start\n"); 84 83 for ( i; num_times ) { 85 printf("% lu\n", i);84 printf("%zu\n", i); 86 85 A{chan_size}; 87 86 B{chan_size};
Note:
See TracChangeset
for help on using the changeset viewer.