source: tests/concurrent/barrier/generation.cfa @ 93b8cf4

ADTast-experimentalenumpthread-emulationqualifiedEnum
Last change on this file since 93b8cf4 was 93b8cf4, checked in by Thierry Delisle <tdelisle@…>, 2 years ago

Added a simple barrier and accompagnying tests.

  • Property mode set to 100644
File size: 959 bytes
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// concurrent/barrier/generation.cfa -- simple test that validates barriers by printing
8//                                      alphabetical generations
9//
10// Author           : Thierry Delisle
11// Created On       : Thu Mar 31 16:43:45 2022
12// Last Modified By :
13// Last Modified On :
14// Update Count     :
15//
16
17
18int NUM_THREADS = 9;
19int NUM_LAPS = 53;
20
21#include <concurrency/barrier.hfa>
22#include <fstream.hfa>
23#include <mutex_stmt.hfa>
24#include <thread.hfa>
25
26barrier bar = { NUM_THREADS };
27
28thread Tester {};
29void main( Tester & this ) {
30        for(NUM_LAPS)
31                for(c; 'A' ~= 'Z') {
32                        yield(prng(this, 10));
33                        mutex(sout) sout | c | nonl;
34                        yield(prng(this, 10));
35                        block(bar);
36                }
37}
38
39int main() {
40        processor p[4];
41        {
42                Tester testers[NUM_THREADS];
43        }
44        sout | nl;
45}
Note: See TracBrowser for help on using the repository browser.