Changeset 54dd994 for tests/concurrent/examples/boundedBufferEXT.cfa
- Timestamp:
- Jun 24, 2019, 10:30:47 AM (6 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/examples/boundedBufferEXT.cfa
r3c6e417 r54dd994 10 10 // Created On : Wed Apr 18 22:52:12 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 22 13:41:33201913 // Update Count : 1 212 // Last Modified On : Fri Jun 21 08:19:20 2019 13 // Update Count : 14 14 14 // 15 15 … … 52 52 } 53 53 54 const int Sentinel = -1;54 enum { Sentinel = -1 }; 55 55 56 56 thread Producer { … … 59 59 }; 60 60 void main( Producer & prod ) with( prod ) { 61 for ( i nt i = 1; i <= N; i += 1) {61 for ( i; 1 ~= N ) { 62 62 yield( random( 5 ) ); 63 63 insert( buffer, 1 ); … … 99 99 srandom( 1003 ); 100 100 101 for ( i = 0; i < Cons; i += 1 ) {// create consumers101 for ( i; Cons ) { // create consumers 102 102 cons[i] = new( &buffer, sums[i] ); 103 103 } // for 104 for ( i = 0; i < Prods; i += 1 ) {// create producers104 for ( i; Prods ) { // create producers 105 105 prods[i] = new( &buffer, 100000 ); 106 106 } // for 107 107 108 for ( i = 0; i < Prods; i += 1 ) {// wait for producers to finish108 for ( i; Prods ) { // wait for producers to finish 109 109 delete( prods[i] ); 110 110 } // for 111 for ( i = 0; i < Cons; i += 1 ) {// generate sentinal values to stop consumers111 for ( i; Cons ) { // generate sentinal values to stop consumers 112 112 insert( buffer, Sentinel ); 113 113 } // for 114 114 int sum = 0; 115 for ( i = 0; i < Cons; i += 1 ) {// wait for consumers to finish115 for ( i; Cons ) { // wait for consumers to finish 116 116 delete( cons[i] ); 117 117 sum += sums[i];
Note:
See TracChangeset
for help on using the changeset viewer.