Ignore:
Timestamp:
Sep 18, 2023, 10:21:29 AM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
e4c3819
Parents:
e3784a50 (diff), 7edf912 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    re3784a50 ra2c2363  
    77#include <time.hfa>
    88
    9 size_t Processors = 1, Channels = 4, Producers = 2, Consumers = 2, ChannelSize = 128;
     9ssize_t Processors = 1, Channels = 4, Producers = 2, Consumers = 2, ChannelSize = 128;
    1010
    1111owner_lock o;
     
    9090      case 4:
    9191                if ( strcmp( argv[3], "d" ) != 0 ) {                    // default ?
    92                         if ( atoi( argv[3] ) < 1 ) goto Usage;
    93                         ChannelSize = atoi( argv[3] );
     92                        ChannelSize = ato( argv[3] );
     93                        if ( ChannelSize < 1 ) fallthru default;
    9494                } // if
    9595      case 3:
    9696                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    97                         if ( atoi( argv[2] ) < 1 ) goto Usage;
    98                         Channels = atoi( argv[2] );
     97                        Channels = ato( argv[2] );
     98                        if ( Channels < 1 ) fallthru default;
    9999                } // if
    100100      case 2:
    101101                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    102                         if ( atoi( argv[1] ) < 1 ) goto Usage;
    103                         Processors = atoi( argv[1] );
     102                        Processors = ato( argv[1] );
     103                        if ( Processors < 1 ) fallthru default;
    104104                } // if
    105105          case 1:                                                                                       // use defaults
    106106                break;
    107107          default:
    108           Usage:
    109                 sout | "Usage: " | argv[0]
     108                exit | "Usage: " | argv[0]
    110109             | " [ processors > 0 | d ]"
    111110             | " [ producers > 0 | d ]"
    112111             | " [ consumers > 0 | d ]"
    113112             | " [ channels > 0 | d ]";
    114                 exit( EXIT_FAILURE );
    115113    }
    116114    processor p[Processors - 1];
Note: See TracChangeset for help on using the changeset viewer.