ADTast-experimental
Last change
on this file since 372b6d3 was
357ab79,
checked in by caparsons <caparson@…>, 22 months ago
|
moved unified locking tests to be under concurrent directory since they probably should have been there this whole time
|
-
Property mode set to
100644
|
File size:
493 bytes
|
Rev | Line | |
---|
[357ab79] | 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.