Changeset 3aa1d22 for tests/concurrent
- Timestamp:
- Jun 21, 2019, 11:46:55 AM (5 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:
- 49dee5e
- Parents:
- d38c4b4
- Location:
- tests/concurrent/examples
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/examples/boundedBufferEXT.cfa
rd38c4b4 r3aa1d22 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]; -
tests/concurrent/examples/boundedBufferINT.cfa
rd38c4b4 r3aa1d22 10 10 // Created On : Mon Oct 30 12:45:13 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 22 13:41:52201913 // Update Count : 8812 // Last Modified On : Fri Jun 21 08:20:46 2019 13 // Update Count : 90 14 14 // 15 15 … … 53 53 } 54 54 55 const int Sentinel = -1;55 enum { Sentinel = -1 }; 56 56 57 57 thread Producer { … … 60 60 }; 61 61 void main( Producer & prod ) with( prod ) { 62 for ( i nt i = 1; i <= N; i += 1) {62 for ( i; 1 ~= N ) { 63 63 yield( random( 5 ) ); 64 64 insert( buffer, 1 ); … … 100 100 srandom( 1003 ); 101 101 102 for ( i = 0; i < Cons; i += 1 ) {// create consumers102 for ( i; Cons ) { // create consumers 103 103 cons[i] = new( &buffer, sums[i] ); 104 104 } // for 105 for ( i = 0; i < Prods; i += 1 ) {// create producers105 for ( i; Prods ) { // create producers 106 106 prods[i] = new( &buffer, 100000 ); 107 107 } // for 108 108 109 for ( i = 0; i < Prods; i += 1 ) {// wait for producers to finish109 for ( i; Prods ) { // wait for producers to finish 110 110 delete( prods[i] ); 111 111 } // for 112 for ( i = 0; i < Cons; i += 1 ) {// generate sentinal values to stop consumers112 for ( i; Cons ) { // generate sentinal values to stop consumers 113 113 insert( buffer, Sentinel ); 114 114 } // for 115 115 int sum = 0; 116 for ( i = 0; i < Cons; i += 1 ) {// wait for consumers to finish116 for ( i; Cons ) { // wait for consumers to finish 117 117 delete( cons[i] ); 118 118 sum += sums[i]; -
tests/concurrent/examples/datingService.cfa
rd38c4b4 r3aa1d22 10 10 // Created On : Mon Oct 30 12:56:20 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 22 13:41:39201913 // Update Count : 3 112 // Last Modified On : Fri Jun 21 11:32:34 2019 13 // Update Count : 38 14 14 // 15 15 … … 95 95 srandom( /*getpid()*/ 103 ); 96 96 97 for ( unsigned int i = 0; i < CompCodes; i += 1) {98 girls[i] = new( &TheExchange, i, i ); 97 for ( i; (unsigned int)CompCodes ) { 98 girls[i] = new( &TheExchange, i, i ); // TheExchange constructor needs unsigned int 99 99 boys[i] = new( &TheExchange, i, CompCodes - ( i + 1 ) ); 100 100 } // for 101 101 102 for ( unsigned int i = 0; i < CompCodes; i += 1) {102 for ( i; CompCodes ) { 103 103 delete( boys[i] ); 104 104 delete( girls[i] ); 105 105 } // for 106 106 107 for ( unsigned int i = 0; i < CompCodes; i += 1) {107 for ( i; CompCodes ) { 108 108 if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort(); 109 109 } // for -
tests/concurrent/examples/quickSort.cfa
rd38c4b4 r3aa1d22 11 11 // Created On : Wed Dec 6 12:15:52 2017 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Mar 22 13:42:01201914 // Update Count : 17 013 // Last Modified On : Fri Jun 21 08:27:45 2019 14 // Update Count : 172 15 15 // 16 16 … … 138 138 if ( eof( unsortedfile ) ) break; 139 139 int * values = alloc( size ); // values to be sorted, too large to put on stack 140 for ( int counter = 0; counter < size; counter += 1 ) {// read unsorted numbers140 for ( counter; size ) { // read unsorted numbers 141 141 unsortedfile | values[counter]; 142 142 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; … … 148 148 Quicksort QS = { values, size - 1, 0 }; // sort values 149 149 } // wait until sort tasks terminate 150 for ( int counter = 0; counter < size; counter += 1 ) {// print sorted list150 for ( counter; size ) { // print sorted list 151 151 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; 152 152 sortedfile | values[counter]; … … 163 163 164 164 int * values = alloc( size ); // values to be sorted, too large to put on stack 165 for ( int counter = 0; counter < size; counter += 1 ) {// generate unsorted numbers165 for ( counter; size ) { // generate unsorted numbers 166 166 values[counter] = size - counter; // descending values 167 167 } // for … … 170 170 } // wait until sort tasks terminate 171 171 172 // for ( int counter = 0; counter < size - 1; counter += 1 ) {// check sorting172 // for ( counter; size - 1 ) { // check sorting 173 173 // if ( values[counter] > values[counter + 1] ) abort(); 174 174 // } // for -
tests/concurrent/examples/quickSort.generic.cfa
rd38c4b4 r3aa1d22 11 11 // Created On : Wed Dec 6 12:15:52 2017 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Mar 15 14:52:41201914 // Update Count : 14 713 // Last Modified On : Fri Jun 21 08:28:20 2019 14 // Update Count : 149 15 15 // 16 16 … … 141 141 if ( eof( unsortedfile ) ) break; 142 142 ELEMTYPE * values = alloc( size ); // values to be sorted, too large to put on stack 143 for ( int counter = 0; counter < size; counter += 1 ) {// read unsorted numbers143 for ( counter; size ) { // read unsorted numbers 144 144 unsortedfile | values[counter]; 145 145 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; … … 151 151 Quicksort(ELEMTYPE) QS = { values, size - 1, 0 }; // sort values 152 152 } // wait until sort tasks terminate 153 for ( int counter = 0; counter < size; counter += 1 ) {// print sorted list153 for ( counter; size ) { // print sorted list 154 154 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; 155 155 sortedfile | values[counter]; … … 166 166 167 167 ELEMTYPE * values = alloc( size ); // values to be sorted, too large to put on stack 168 for ( int counter = 0; counter < size; counter += 1 ) {// generate unsorted numbers168 for ( counter; size ) { // generate unsorted numbers 169 169 values[counter] = size - counter; // descending values 170 170 } // for … … 173 173 } // wait until sort tasks terminate 174 174 175 // for ( int counter = 0; counter < size - 1; counter += 1 ) {// check sorting175 // for ( counter; size - 1 ) { // check sorting 176 176 // if ( values[counter] > values[counter + 1] ) abort(); 177 177 // } // for
Note: See TracChangeset
for help on using the changeset viewer.