Changeset 5e0b6657 for tests/concurrency/waituntil/futures.cfa
- Timestamp:
- Dec 8, 2025, 11:29:33 AM (2 months ago)
- Branches:
- master
- Children:
- 79ba50c
- Parents:
- 8f448e0 (diff), 79ec8c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
tests/concurrency/waituntil/futures.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/waituntil/futures.cfa
r8f448e0 r5e0b6657 1 #include < select.hfa>1 #include <fstream.hfa> 2 2 #include <future.hfa> 3 3 #include <thread.hfa> … … 5 5 future(int) A, B, C; 6 6 7 semaphore s{0}; 8 9 thread Server1 {}; 10 void main( Server1 & ) { 11 fulfil(B, 3); 12 P( s ); 13 fulfil(A, 2); 14 fulfil(C, 4); 15 } 16 17 thread Server2 {}; 18 void main( Server2 & ) { 19 fulfil(B, 6); 20 fulfil(A, 5); 21 fulfil(C, 7); 7 thread Server {}; 8 void main( Server & ) { 9 B( 3 ); // fulfil( B, 3 ); 10 A( 2 ); 11 C( 4 ); 22 12 } 23 13 24 14 int main() { 25 processor proc[1]; 26 printf("start\n"); // currently not working 27 { 28 Server1 s1; 29 waituntil( A ) { get(A); } 30 or waituntil( B ) { get(B); V( s ); } 31 and waituntil( C ) { get(C); } 32 } 33 reset(A); 34 reset(B); 35 reset(C); 36 for ( int i = 0; i < 8; i++ ) { 37 { 38 Server2 s2; 39 when( i % 2 == 0 ) waituntil( A ) { get(A); } 40 or when( i % 4 < 2 ) waituntil( B ) { get(B); } 41 and when( i < 4 ) waituntil( C ) { get(C); } 42 } 43 reset(A); 44 reset(B); 45 reset(C); 46 { 47 Server2 s2; 48 ( 49 when( i % 2 == 0 ) waituntil( A ) { get(A); } 50 or when( i % 4 < 2 ) waituntil( B ) { get(B); } 51 ) 52 and when( i < 4 ) waituntil( C ) { get(C); } 53 } 54 reset(A); 55 reset(B); 56 reset(C); 57 } 58 59 printf("end\n"); 60 return 0; 15 processor p; 16 sout | "start"; 17 { 18 size_t count = 0; 19 Server s; 20 for ( ; count < 3; ) { 21 waituntil( A ) { count += 1; A(); /* get( A ) */ } 22 or waituntil( B ) { count += 1; B(); } 23 or waituntil( C ) { count += 1; C(); } 24 } 25 reset( A ); reset( B ); reset( C ); 26 } 27 { 28 size_t count = 0; 29 Server s; 30 for ( ; count < 3; ) { 31 waituntil( A ) { count += 1; A(); /* get( A ) */ } 32 or waituntil( B ) { count += 1; B(); } 33 and waituntil( C ) { count += 1; C(); } 34 } 35 reset( A ); reset( B ); reset( C ); 36 } 37 size_t count = 0; 38 for ( i; 8 ) { 39 { 40 Server s; 41 when( i % 2 == 0 ) waituntil( A ) { count += 1; A(); } 42 or when( i % 4 < 2 ) waituntil( B ) { count += 1; B(); } 43 and when( i < 4 ) waituntil( C ) { count += 1; C(); } 44 } 45 reset( A ); reset( B ); reset( C ); 46 { 47 Server s; 48 ( when( i % 2 == 0 ) waituntil( A ) { count += 1; A(); } 49 or when( i % 4 < 2 ) waituntil( B ) { count += 1; B(); } 50 ) and when( i < 4 ) waituntil( C ) { count += 1; C(); } 51 } 52 reset( A ); reset( B ); reset( C ); 53 } // for 54 sout | "end"; 61 55 }
Note:
See TracChangeset
for help on using the changeset viewer.