Changeset 7a925a41 for tests/exceptions
- Timestamp:
- Oct 1, 2023, 12:29:04 PM (15 months ago)
- Branches:
- master
- Children:
- 16b5d11
- Parents:
- 26be854
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/hotpotato.cfa
r26be854 r7a925a41 65 65 } // vote 66 66 67 static void terminate( Player & player ) { // resume umpire68 resume( player );69 assert( false ); // no return70 } // terminate71 72 67 void init( Player & player, Player & lp, Player & rp ) with(player) { // supply partners 73 68 partner[LEFT] = &lp; … … 79 74 return player.id; 80 75 } // getId 81 82 void toss( Player & player ) { // tossed the potato83 resume( player );84 } // toss85 76 86 77 void main( Player & player ) with(player) { … … 99 90 size_t side = prng( prng, 2 ); 100 91 sout | id | " -> " | nonl; 101 toss( *partner[ side ] ); // random toss left/right92 resume( *partner[ side ] ); // random toss left/right 102 93 } // for 103 94 } catchResume( Terminate * v ) { … … 122 113 } // if 123 114 resumeAt( umpire, ExceptionInst( Terminate, &player ) ); 124 terminate( umpire );115 resume( umpire ); // resume umpire to terminate this player 125 116 assert( false ); // no return 126 117 } // try … … 198 189 &umpire = players[rposn]; // designate umpire and start game 199 190 sout | "U " | nonl; 200 toss( *players[rposn] );191 resume( *players[rposn] ); 201 192 delete( &umpire ); 202 193 }
Note: See TracChangeset
for help on using the changeset viewer.