#include #include #include future(int) A, B, C; thread Server {}; void main( Server & ) { B( 3 ); // fulfil( B, 3 ); A( 2 ); C( 4 ); } int main() { processor p; sout | "start"; { size_t count = 0; Server s; for ( ; count < 3; ) { waituntil( A ) { count += 1; A(); /* get( A ) */ } or waituntil( B ) { count += 1; B(); } or waituntil( C ) { count += 1; C(); } } reset( A ); reset( B ); reset( C ); } { size_t count = 0; Server s; for ( ; count < 3; ) { waituntil( A ) { count += 1; A(); /* get( A ) */ } or waituntil( B ) { count += 1; B(); } and waituntil( C ) { count += 1; C(); } } reset( A ); reset( B ); reset( C ); } size_t count = 0; for ( i; 8 ) { { Server s; when( i % 2 == 0 ) waituntil( A ) { count += 1; A(); } or when( i % 4 < 2 ) waituntil( B ) { count += 1; B(); } and when( i < 4 ) waituntil( C ) { count += 1; C(); } } reset( A ); reset( B ); reset( C ); { Server s; ( when( i % 2 == 0 ) waituntil( A ) { count += 1; A(); } or when( i % 4 < 2 ) waituntil( B ) { count += 1; B(); } ) and when( i < 4 ) waituntil( C ) { count += 1; C(); } } reset( A ); reset( B ); reset( C ); } // for sout | "end"; }