Changeset cca568e for tests/concurrent
- Timestamp:
- Jan 17, 2020, 3:01:27 PM (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:
- 9e63a2b
- Parents:
- 4a063df
- Location:
- tests/concurrent
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/examples/boundedBufferEXT.cfa
r4a063df rcca568e 10 10 // Created On : Wed Apr 18 22:52:12 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 21 08:19:20 201913 // Update Count : 1 412 // Last Modified On : Thu Jan 16 22:36:34 2020 13 // Update Count : 15 14 14 // 15 15 … … 37 37 38 38 void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) { 39 if ( count == BufferSize ) waitfor( remove ,buffer );39 if ( count == BufferSize ) waitfor( remove : buffer ); 40 40 elements[back] = elem; 41 41 back = ( back + 1 ) % BufferSize; … … 44 44 45 45 T remove( Buffer(T) & mutex buffer ) with( buffer ) { 46 if ( count == 0 ) waitfor( insert ,buffer );46 if ( count == 0 ) waitfor( insert : buffer ); 47 47 T elem = elements[front]; 48 48 front = ( front + 1 ) % BufferSize; -
tests/concurrent/examples/boundedBufferTHREAD.cfa
r4a063df rcca568e 10 10 // Created On : Wed Apr 18 22:52:12 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 21 11:50:12 201913 // Update Count : 2 412 // Last Modified On : Thu Jan 16 23:09:43 2020 13 // Update Count : 25 14 14 // 15 15 … … 44 44 void main( Buffer & buffer ) with( buffer ) { 45 45 for () { 46 waitfor( ^?{} ,buffer ) {46 waitfor( ^?{} : buffer ) { 47 47 break; 48 } or when ( count != 20 ) waitfor( insert ,buffer ) {48 } or when ( count != 20 ) waitfor( insert : buffer ) { 49 49 back = (back + 1) % 20; 50 50 count += 1; 51 } or when ( count != 0 ) waitfor( remove ,buffer ) {51 } or when ( count != 0 ) waitfor( remove : buffer ) { 52 52 front = (front + 1) % 20; 53 53 count -= 1; -
tests/concurrent/examples/gortn.cfa
r4a063df rcca568e 10 10 // Created On : Wed Feb 20 08:02:37 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 21 08:25:03 201913 // Update Count : 412 // Last Modified On : Thu Jan 16 22:43:40 2020 13 // Update Count : 5 14 14 // 15 15 … … 26 26 void main( GoRtn & gortn ) with( gortn ) { 27 27 for () { 28 waitfor( mem1 ,gortn ) sout | i;29 or waitfor( mem2 ,gortn ) sout | f;30 or waitfor( mem3 ,gortn ) sout | m.i | m.j;31 or waitfor( ^?{} ,gortn ) break;28 waitfor( mem1 : gortn ) sout | i; 29 or waitfor( mem2 : gortn ) sout | f; 30 or waitfor( mem3 : gortn ) sout | m.i | m.j; 31 or waitfor( ^?{} : gortn ) break; 32 32 } 33 33 } -
tests/concurrent/waitfor/barge.cfa
r4a063df rcca568e 65 65 yield(random( 10 )); 66 66 this.state = WAITFOR; 67 waitfor(do_call ,this) {67 waitfor(do_call : this) { 68 68 sout | i; 69 69 } -
tests/concurrent/waitfor/dtor.cfa
r4a063df rcca568e 47 47 yield(random( 10 )); 48 48 set_state( this, MAIN ); 49 waitfor( ^?{} ,this ) {49 waitfor( ^?{} : this ) { 50 50 set_state( this, AFTER ); 51 51 } -
tests/concurrent/waitfor/else.cfa
r4a063df rcca568e 14 14 sout | "Starting"; 15 15 16 when( false ) waitfor( notcalled ,m );16 when( false ) waitfor( notcalled : m ); 17 17 18 18 sout | "Step" | i++; 19 19 20 waitfor( notcalled ,m ); or else {20 waitfor( notcalled : m ); or else { 21 21 sout | "else called"; 22 22 } … … 24 24 sout | "Step" | i++; 25 25 26 when( true ) waitfor( notcalled ,m ); or when( true ) else {26 when( true ) waitfor( notcalled : m ); or when( true ) else { 27 27 sout | "else called"; 28 28 } … … 30 30 sout | "Step" | i++; 31 31 32 when( false ) waitfor( notcalled ,m ); or when( true ) else {32 when( false ) waitfor( notcalled : m ); or when( true ) else { 33 33 sout | "else called"; 34 34 } … … 36 36 sout | "Step" | i++; 37 37 38 when( false ) waitfor( notcalled ,m ); or when( false ) else {38 when( false ) waitfor( notcalled : m ); or when( false ) else { 39 39 sout | "else called"; 40 40 } -
tests/concurrent/waitfor/parse.cfa
r4a063df rcca568e 24 24 25 25 //--------------------------------------- 26 waitfor( f1 ,a ) {26 waitfor( f1 : a ) { 27 27 1; 28 28 } 29 29 30 30 //--------------------------------------- 31 waitfor( f1 ,a ) {31 waitfor( f1 : a ) { 32 32 2; 33 33 } 34 waitfor( f2 ,a ) {34 waitfor( f2 : a ) { 35 35 3; 36 36 } 37 37 38 38 //--------------------------------------- 39 when( 1 < 3 ) waitfor( f2 ,a, a ) {39 when( 1 < 3 ) waitfor( f2 : a, a ) { 40 40 4; 41 41 } … … 45 45 46 46 //--------------------------------------- 47 when( 2 < 3 ) waitfor( f3 ,a ) {47 when( 2 < 3 ) waitfor( f3 : a ) { 48 48 5; 49 49 } … … 53 53 54 54 //--------------------------------------- 55 when( 3 < 3 ) waitfor( f3 ,a, a ) {55 when( 3 < 3 ) waitfor( f3 : a, a ) { 56 56 7; 57 57 } … … 64 64 65 65 //--------------------------------------- 66 when( 6 < 3 ) waitfor( f3 ,a, a, a ) {66 when( 6 < 3 ) waitfor( f3 : a, a, a ) { 67 67 10; 68 68 } 69 or when( 7 < 3 ) waitfor( f1 ,a ) {69 or when( 7 < 3 ) waitfor( f1 : a ) { 70 70 11; 71 71 } … … 75 75 76 76 //--------------------------------------- 77 when( 8 < 3 ) waitfor( f3 ,a, a ) {77 when( 8 < 3 ) waitfor( f3 : a, a ) { 78 78 13; 79 79 } 80 or waitfor( f1 ,a ) {80 or waitfor( f1 : a ) { 81 81 14; 82 82 } … … 86 86 87 87 //--------------------------------------- 88 when( 10 < 3 ) waitfor( f1 ,a ) {88 when( 10 < 3 ) waitfor( f1 : a ) { 89 89 16; 90 90 } 91 or waitfor( f2 ,a, a ) {91 or waitfor( f2 : a, a ) { 92 92 17; 93 93 } … … 100 100 } 101 101 102 int main() { 103 104 } 102 int main() {} -
tests/concurrent/waitfor/parse2.cfa
r4a063df rcca568e 10 10 // Created On : Wed Aug 30 17:53:29 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 22 13:42:11 201913 // Update Count : 312 // Last Modified On : Thu Jan 16 23:13:37 2020 13 // Update Count : 6 14 14 // 15 15 … … 26 26 } 27 27 28 waitfor( x ,z ) {28 waitfor( x : z ) { 29 29 } 30 30 … … 37 37 or waitfor( y ); 38 38 39 waitfor( x ,z );39 waitfor( x : z ); 40 40 or waitfor( y ); 41 41 … … 43 43 or when( true ) waitfor( y ); 44 44 45 when( true ) waitfor( x ,z );45 when( true ) waitfor( x : z ); 46 46 or when( true ) waitfor( y ); 47 47 … … 50 50 } 51 51 52 waitfor( x ,z ) {52 waitfor( x : z ) { 53 53 } or waitfor( y ) { 54 54 } … … 80 80 or else; 81 81 82 when( true ) waitfor( x ,z );82 when( true ) waitfor( x : z ); 83 83 or else; 84 84 … … 99 99 } 100 100 101 when( true ) waitfor( x ,z );101 when( true ) waitfor( x : z ); 102 102 or else { 103 103 } … … 115 115 or when( true ) else; 116 116 117 when( true ) waitfor( x ,z );117 when( true ) waitfor( x : z ); 118 118 or when( true ) else; 119 119 … … 134 134 } 135 135 136 when( true ) waitfor( x ,z );136 when( true ) waitfor( x : z ); 137 137 or when( true ) else { 138 138 } … … 149 149 or timeout( 3 ); 150 150 151 waitfor( x ,z );151 waitfor( x : z ); 152 152 or timeout( 3 ); 153 153 … … 163 163 } 164 164 165 when( true ) waitfor( x ,z ) {165 when( true ) waitfor( x : z ) { 166 166 } or timeout( 3 ) { 167 167 } … … 171 171 } 172 172 173 when( true ) waitfor( x ,z ) {173 when( true ) waitfor( x : z ) { 174 174 } or when ( true ) timeout( 3 ) { 175 175 } … … 229 229 230 230 int or, timeout; 231 waitfor( timeout ,7 ) 3;232 waitfor( timeout , 7 ) 3; or waitfor( timeout,7 ) 3;233 when( or ) waitfor( or ,) { 4; } or timeout( 1 ) 3;234 when( 3 ) waitfor( or ,2 ) 4; or else 4;235 when( 3 ) waitfor( or ,3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;236 when( 3 ) waitfor( or , or ) 3; or when( or ) waitfor( or,timeout ) 4; or else 4;237 when( 3 ) waitfor( or , or ) 3; or waitfor( or,9 ) 4; or when( or ) timeout( timeout ) 4;238 when( 3 ) waitfor( or , 3 ) 3; or waitfor( or,7 ) or; or timeout( 1 ) or; or when( 3 ) else or;231 waitfor( timeout : 7 ) 3; 232 waitfor( timeout : 7 ) 3; or waitfor( timeout : 7 ) 3; 233 when( or ) waitfor( or : ) { 4; } or timeout( 1 ) 3; 234 when( 3 ) waitfor( or : 2 ) 4; or else 4; 235 when( 3 ) waitfor( or : 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout; 236 when( 3 ) waitfor( or : or ) 3; or when( or ) waitfor( or : timeout ) 4; or else 4; 237 when( 3 ) waitfor( or : or ) 3; or waitfor( or : 9 ) 4; or when( or ) timeout( timeout ) 4; 238 when( 3 ) waitfor( or : 3 ) 3; or waitfor( or : 7 ) or; or timeout( 1 ) or; or when( 3 ) else or; 239 239 240 240 // test else selection -
tests/concurrent/waitfor/recurse.cfa
r4a063df rcca568e 66 66 67 67 rand_yield(); 68 waitfor( call4 ,this );68 waitfor( call4 : this ); 69 69 rand_yield(); 70 70 … … 78 78 79 79 rand_yield(); 80 waitfor( call3 ,this );80 waitfor( call3 : this ); 81 81 rand_yield(); 82 82 … … 92 92 93 93 rand_yield(); 94 waitfor( call2 ,this );94 waitfor( call2 : this ); 95 95 rand_yield(); 96 96 -
tests/concurrent/waitfor/statment.cfa
r4a063df rcca568e 101 101 102 102 while( !done ) { 103 waitfor( get_index ,this );104 or waitfor( call1 ,this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }105 or waitfor( call2 ,this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }106 or waitfor( call3 ,this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }107 or waitfor( call4 ,this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }108 or waitfor( call5 ,this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }109 or waitfor( call6 ,this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }110 or waitfor( call7 ,this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }103 waitfor( get_index : this ); 104 or waitfor( call1 : this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } } 105 or waitfor( call2 : this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } } 106 or waitfor( call3 : this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } } 107 or waitfor( call4 : this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } } 108 or waitfor( call5 : this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } } 109 or waitfor( call6 : this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } } 110 or waitfor( call7 : this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } } 111 111 112 112 done = true; -
tests/concurrent/waitfor/when.cfa
r4a063df rcca568e 58 58 void arbiter( global_t & mutex this ) { 59 59 for( int i = 0; i < N; i++ ) { 60 when( this.last_call == 6 ) waitfor( call1 ,this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }61 or when( this.last_call == 1 ) waitfor( call2 ,this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }62 or when( this.last_call == 2 ) waitfor( call3 ,this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }63 or when( this.last_call == 3 ) waitfor( call4 ,this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }64 or when( this.last_call == 4 ) waitfor( call5 ,this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }65 or when( this.last_call == 5 ) waitfor( call6 ,this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }60 when( this.last_call == 6 ) waitfor( call1 : this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } } 61 or when( this.last_call == 1 ) waitfor( call2 : this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } } 62 or when( this.last_call == 2 ) waitfor( call3 : this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } } 63 or when( this.last_call == 3 ) waitfor( call4 : this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } } 64 or when( this.last_call == 4 ) waitfor( call5 : this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } } 65 or when( this.last_call == 5 ) waitfor( call6 : this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } } 66 66 67 67 sout | this.last_call;
Note: See TracChangeset
for help on using the changeset viewer.