- Timestamp:
- Jan 14, 2022, 7:01:21 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- a2a4566
- Parents:
- 145dcd5 (diff), 9ee3f54 (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. - Location:
- tests/io
- Files:
-
- 2 added
- 2 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
tests/io/io-acquire-in.cfa
r145dcd5 rc90db2d 10 10 // Created On : Mon Mar 1 18:40:09 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Oct 6 18:04:58 202113 // Update Count : 7 212 // Last Modified On : Fri Jan 14 09:13:43 2022 13 // Update Count : 73 14 14 // 15 15 … … 18 18 #include <mutex_stmt.hfa> 19 19 20 thread T {}; 21 void main( T & ) { 22 // output from parallel threads should not be scrambled 20 Duration default_preemption() { return 0; } 23 21 24 for ( 100 ) { // expression protection25 mutex(sout) sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;26 }27 mutex( sout ) { // statement protection28 for ( 100 ) {29 sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;30 }31 }32 { // duplicate protection demonstrating recursive lock33 ofstream & h1( ofstream & os ) { // helper34 mutex( os ) return os | 1 | 2 | 3 | 4; // unnecessary mutex35 }36 ofstream & h2( ofstream & os ) { // helper37 mutex( os ) return os | 6 | 7 | 8 | 9; // unnecessary mutex38 }39 mutex( sout ) { // unnecessary mutex40 for ( 100 ) {41 mutex( sout ) {42 sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;43 sout | h1 | 5 | h2; // refactored code44 }45 }46 }47 }48 }49 22 // above output used as input to parallel threads 50 23 thread T2 {}; … … 79 52 processor p; 80 53 { 81 T t[5];82 }83 {84 54 T2 t[5]; 85 55 } 56 sout | "done"; 86 57 } 87 58 -
tests/io/io-acquire-no-io.cfa
r145dcd5 rc90db2d 10 10 // Created On : Mon Mar 1 18:40:09 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Oct 6 18:04:58 202113 // Update Count : 7 212 // Last Modified On : Fri Jan 14 09:13:54 2022 13 // Update Count : 73 14 14 // 15 15 … … 17 17 #include <thread.hfa> 18 18 #include <mutex_stmt.hfa> 19 20 Duration default_preemption() { return 0; } 19 21 20 22 multiple_acquisition_lock soutLock, sinLock; -
tests/io/io-acquire.cfa
r145dcd5 rc90db2d 10 10 // Created On : Mon Mar 1 18:40:09 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 10 07:57:12202213 // Update Count : 7 312 // Last Modified On : Fri Jan 14 09:13:18 2022 13 // Update Count : 74 14 14 // 15 15 … … 17 17 #include <thread.hfa> 18 18 #include <mutex_stmt.hfa> 19 20 Duration default_preemption() { return 0; } 19 21 20 22 thread T {};
Note: See TracChangeset
for help on using the changeset viewer.