Last change
on this file since d923fca was
d923fca,
checked in by Andrew Beach <ajbeach@…>, 6 weeks ago
|
Clean-up the warnings of the concurrency tests. A lot of little test level fixes, the most interesting repeated one is some formally redundent fallthough statements. pthread_attr_test had to be rewritten because of library restrictions. Changed some types so they would always be pointer sized. There was a library change, there was a function that could not be implemented; I trust that it is included for a reason so I just put it in a comment. There is a change to the compiler, wait-until now uses goto. The labelled breaks were code generated as unlabelled breaks and although it worked out slipped through some checks. Finally, there is one warning that I cannot solve at this time so tests that produce it have been put in their own lax group.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[a33a5e2] | 1 | #include <select.hfa> |
---|
| 2 | #include <future.hfa> |
---|
| 3 | #include <thread.hfa> |
---|
| 4 | |
---|
| 5 | future(int) A, B, C; |
---|
| 6 | |
---|
| 7 | semaphore s{0}; |
---|
| 8 | |
---|
| 9 | thread Server1 {}; |
---|
[d923fca] | 10 | void main( Server1 & ) { |
---|
[a33a5e2] | 11 | fulfil(B, 3); |
---|
| 12 | P( s ); |
---|
| 13 | fulfil(A, 2); |
---|
| 14 | fulfil(C, 4); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | thread Server2 {}; |
---|
[d923fca] | 18 | void main( Server2 & ) { |
---|
[a33a5e2] | 19 | fulfil(B, 6); |
---|
| 20 | fulfil(A, 5); |
---|
| 21 | fulfil(C, 7); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | int main() { |
---|
| 25 | processor proc[1]; |
---|
| 26 | printf("start\n"); // currently not working |
---|
| 27 | { |
---|
| 28 | Server1 s1; |
---|
| 29 | waituntil( A ) { get(A); } |
---|
| 30 | or waituntil( B ) { get(B); V( s ); } |
---|
| 31 | and waituntil( C ) { get(C); } |
---|
| 32 | } |
---|
| 33 | reset(A); |
---|
| 34 | reset(B); |
---|
| 35 | reset(C); |
---|
| 36 | for ( int i = 0; i < 8; i++ ) { |
---|
| 37 | { |
---|
| 38 | Server2 s2; |
---|
| 39 | when( i % 2 == 0 ) waituntil( A ) { get(A); } |
---|
| 40 | or when( i % 4 < 2 ) waituntil( B ) { get(B); } |
---|
| 41 | and when( i < 4 ) waituntil( C ) { get(C); } |
---|
| 42 | } |
---|
| 43 | reset(A); |
---|
| 44 | reset(B); |
---|
| 45 | reset(C); |
---|
| 46 | { |
---|
| 47 | Server2 s2; |
---|
| 48 | ( |
---|
| 49 | when( i % 2 == 0 ) waituntil( A ) { get(A); } |
---|
| 50 | or when( i % 4 < 2 ) waituntil( B ) { get(B); } |
---|
| 51 | ) |
---|
| 52 | and when( i < 4 ) waituntil( C ) { get(C); } |
---|
| 53 | } |
---|
| 54 | reset(A); |
---|
| 55 | reset(B); |
---|
| 56 | reset(C); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | printf("end\n"); |
---|
| 60 | return 0; |
---|
[d923fca] | 61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.