Ignore:
Timestamp:
Jun 24, 2019, 10:30:47 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
84917e2
Parents:
3c6e417 (diff), 9e0a360 (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/concurrent/examples/boundedBufferEXT.cfa

    r3c6e417 r54dd994  
    1010// Created On       : Wed Apr 18 22:52:12 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 22 13:41:33 2019
    13 // Update Count     : 12
     12// Last Modified On : Fri Jun 21 08:19:20 2019
     13// Update Count     : 14
    1414//
    1515
     
    5252}
    5353
    54 const int Sentinel = -1;
     54enum { Sentinel = -1 };
    5555
    5656thread Producer {
     
    5959};
    6060void main( Producer & prod ) with( prod ) {
    61         for ( int i = 1; i <= N; i += 1 ) {
     61        for ( i; 1 ~= N ) {
    6262                yield( random( 5 ) );
    6363                insert( buffer, 1 );
     
    9999        srandom( 1003 );
    100100
    101         for ( i = 0; i < Cons; i += 1 ) {                                       // create consumers
     101        for ( i; Cons ) {                                                                       // create consumers
    102102                cons[i] = new( &buffer, sums[i] );
    103103        } // for
    104         for ( i = 0; i < Prods; i += 1 ) {                                      // create producers
     104        for ( i; Prods ) {                                                                      // create producers
    105105                prods[i] = new( &buffer, 100000 );
    106106        } // for
    107107
    108         for ( i = 0; i < Prods; i += 1 ) {                                      // wait for producers to finish
     108        for ( i; Prods ) {                                                                      // wait for producers to finish
    109109                delete( prods[i] );
    110110        } // for
    111         for ( i = 0; i < Cons; i += 1 ) {                                       // generate sentinal values to stop consumers
     111        for ( i; Cons ) {                                                                       // generate sentinal values to stop consumers
    112112                insert( buffer, Sentinel );
    113113        } // for
    114114        int sum = 0;
    115         for ( i = 0; i < Cons; i += 1 ) {                                       // wait for consumers to finish
     115        for ( i; Cons ) {                                                                       // wait for consumers to finish
    116116                delete( cons[i] );
    117117                sum += sums[i];
Note: See TracChangeset for help on using the changeset viewer.