- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/channels/hot_potato.cfa
rc26bea2a r50be8af 8 8 9 9 size_t total_operations = 0; 10 s ize_t Processors = 1, Tasks = 4;10 ssize_t Processors = 1, Tasks = 4; // must be signed 11 11 12 12 owner_lock o; … … 38 38 } 39 39 40 41 40 int main( int argc, char * argv[] ) { 42 41 switch ( argc ) { 43 42 case 3: 44 43 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 45 Tasks = ato i( argv[2] );46 if ( Tasks < 1 ) goto Usage;44 Tasks = ato( argv[2] ); 45 if ( Tasks < 1 ) fallthru default; 47 46 } // if 48 47 case 2: 49 48 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 50 Processors = ato i( argv[1] );51 if ( Processors < 1 ) goto Usage;49 Processors = ato( argv[1] ); 50 if ( Processors < 1 ) fallthru default; 52 51 } // if 53 52 case 1: // use defaults 54 53 break; 55 54 default: 56 Usage: 57 sout | "Usage: " | argv[0] 55 exit | "Usage: " | argv[0] 58 56 | " [ processors (> 0) | 'd' (default " | Processors 59 57 | ") ] [ channel size (>= 0) | 'd' (default " | Tasks 60 58 | ") ]" ; 61 exit( EXIT_FAILURE );62 59 } // switch 60 63 61 processor proc[Processors - 1]; 64 62
Note: See TracChangeset
for help on using the changeset viewer.