Changeset 31ef267 for tests/concurrent/barrier/generation.cfa
- Timestamp:
- Apr 1, 2022, 12:40:35 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 1417f6b
- Parents:
- 93b8cf4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/barrier/generation.cfa
r93b8cf4 r31ef267 15 15 // 16 16 17 // Test validates barrier by having each thread print ABCD... 18 // If the barrier is correct it should print all As, all Bs, etc. 17 19 18 intNUM_THREADS = 9;19 intNUM_LAPS = 53;20 unsigned NUM_THREADS = 9; 21 unsigned NUM_LAPS = 53; 20 22 21 23 #include <concurrency/barrier.hfa> … … 24 26 #include <thread.hfa> 25 27 28 // The barrier we are testing 26 29 barrier bar = { NUM_THREADS }; 30 27 31 28 32 thread Tester {}; 29 33 void main( Tester & this ) { 34 // Repeat the experiment a few times 30 35 for(NUM_LAPS) 36 // For each letters 31 37 for(c; 'A' ~= 'Z') { 38 // Yield for chaos 32 39 yield(prng(this, 10)); 40 41 // Print the generation, no newline because 33 42 mutex(sout) sout | c | nonl; 43 44 // Yield again for more chaos 34 45 yield(prng(this, 10)); 46 47 // Block on the barrier 35 48 block(bar); 36 49 }
Note: See TracChangeset
for help on using the changeset viewer.