ast-experimental
Last change
on this file since bdbf536 was
c26bea2a,
checked in by Peter A. Buhr <pabuhr@…>, 18 months ago
|
first attempt at renaming directory tests/concurrent to tests/concurrency to harmonize with other concurrency directory names
|
-
Property mode set to
100644
|
File size:
493 bytes
|
Line | |
---|
1 | #include "locks.hfa" |
---|
2 | |
---|
3 | fast_block_lock f; |
---|
4 | fast_block_lock f2; |
---|
5 | fast_cond_var( fast_block_lock ) f_c_f; |
---|
6 | |
---|
7 | thread T1 {}; |
---|
8 | bool wait = true; |
---|
9 | bool wait2 = true; |
---|
10 | void main( T1 & this ) { |
---|
11 | lock(f); |
---|
12 | if (wait) { |
---|
13 | wait = false; |
---|
14 | wait(f_c_f, f); |
---|
15 | } else { |
---|
16 | notify_one(f_c_f); |
---|
17 | unlock(f); |
---|
18 | } |
---|
19 | lock(f2); |
---|
20 | if (wait2) { |
---|
21 | wait2 = false; |
---|
22 | wait(f_c_f, f2); |
---|
23 | } else { |
---|
24 | notify_one(f_c_f); |
---|
25 | unlock(f2); |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | int main() { |
---|
30 | T1 t[2]; |
---|
31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.