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