Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrency/channels/hot_potato.cfa

    rc26bea2a r50be8af  
    88
    99size_t total_operations = 0;
    10 size_t Processors = 1, Tasks = 4;
     10ssize_t Processors = 1, Tasks = 4;                                              // must be signed
    1111
    1212owner_lock o;
     
    3838}
    3939
    40 
    4140int main( int argc, char * argv[] ) {
    4241    switch ( argc ) {
    4342          case 3:
    4443                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    45                         Tasks = atoi( argv[2] );
    46             if ( Tasks < 1 ) goto Usage;
     44                        Tasks = ato( argv[2] );
     45            if ( Tasks < 1 ) fallthru default;
    4746                } // if
    4847          case 2:
    4948                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    50                         Processors = atoi( argv[1] );
    51                         if ( Processors < 1 ) goto Usage;
     49                        Processors = ato( argv[1] );
     50                        if ( Processors < 1 ) fallthru default;
    5251                } // if
    5352          case 1:                                                                                       // use defaults
    5453                break;
    5554          default:
    56           Usage:
    57                 sout | "Usage: " | argv[0]
     55                exit | "Usage: " | argv[0]
    5856             | " [ processors (> 0) | 'd' (default " | Processors
    5957                         | ") ] [ channel size (>= 0) | 'd' (default " | Tasks
    6058                         | ") ]" ;
    61                 exit( EXIT_FAILURE );
    6259        } // switch
     60
    6361    processor proc[Processors - 1];
    6462
Note: See TracChangeset for help on using the changeset viewer.