Ignore:
Timestamp:
Jun 21, 2019, 11:46:55 AM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
49dee5e
Parents:
d38c4b4
Message:

change from C to CFA for statements in example programs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrent/examples/boundedBufferINT.cfa

    rd38c4b4 r3aa1d22  
    1010// Created On       : Mon Oct 30 12:45:13 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 22 13:41:52 2019
    13 // Update Count     : 88
     12// Last Modified On : Fri Jun 21 08:20:46 2019
     13// Update Count     : 90
    1414//
    1515
     
    5353}
    5454
    55 const int Sentinel = -1;
     55enum { Sentinel = -1 };
    5656
    5757thread Producer {
     
    6060};
    6161void main( Producer & prod ) with( prod ) {
    62         for ( int i = 1; i <= N; i += 1 ) {
     62        for ( i; 1 ~= N ) {
    6363                yield( random( 5 ) );
    6464                insert( buffer, 1 );
     
    100100        srandom( 1003 );
    101101
    102         for ( i = 0; i < Cons; i += 1 ) {                                       // create consumers
     102        for ( i; Cons ) {                                                                       // create consumers
    103103                cons[i] = new( &buffer, sums[i] );
    104104        } // for
    105         for ( i = 0; i < Prods; i += 1 ) {                                      // create producers
     105        for ( i; Prods ) {                                                                      // create producers
    106106                prods[i] = new( &buffer, 100000 );
    107107        } // for
    108108
    109         for ( i = 0; i < Prods; i += 1 ) {                                      // wait for producers to finish
     109        for ( i; Prods ) {                                                                      // wait for producers to finish
    110110                delete( prods[i] );
    111111        } // for
    112         for ( i = 0; i < Cons; i += 1 ) {                                       // generate sentinal values to stop consumers
     112        for ( i; Cons ) {                                                                       // generate sentinal values to stop consumers
    113113                insert( buffer, Sentinel );
    114114        } // for
    115115        int sum = 0;
    116         for ( i = 0; i < Cons; i += 1 ) {                                       // wait for consumers to finish
     116        for ( i; Cons ) {                                                                       // wait for consumers to finish
    117117                delete( cons[i] );
    118118                sum += sums[i];
Note: See TracChangeset for help on using the changeset viewer.