Last change
on this file since c086c6e was
10b5970,
checked in by Michael Brooks <mlbrooks@…>, 2 weeks ago
|
Fix many test-suite- and libcfa-caused unused variable warnings.
In scope are easy fixes among tests whose sole warnings were unused variable. Reduces the wflags lax list by 40%.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[9319a23] | 1 | #include <locks.hfa> |
---|
| 2 | #include <fstream.hfa> |
---|
| 3 | #include <stdio.h> |
---|
| 4 | #include <channel.hfa> |
---|
| 5 | #include <thread.hfa> |
---|
| 6 | #include <time.hfa> |
---|
| 7 | #include <string.h> |
---|
| 8 | |
---|
| 9 | typedef channel( int ) Channel; |
---|
| 10 | |
---|
| 11 | Channel * ping; |
---|
| 12 | Channel * pong; |
---|
| 13 | |
---|
| 14 | bool done = false; |
---|
| 15 | size_t total_operations = 0; |
---|
| 16 | |
---|
| 17 | thread Pong {}; |
---|
[10b5970] | 18 | void main(Pong &) { |
---|
[9319a23] | 19 | try { |
---|
| 20 | for ( ;; ) { |
---|
| 21 | if ( done ) break; |
---|
| 22 | insert( *ping, 0 ); |
---|
| 23 | remove( *pong ); |
---|
| 24 | } |
---|
| 25 | } catch ( channel_closed * e ) {} |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | thread Ping {}; |
---|
[10b5970] | 29 | void main(Ping &) { |
---|
[9319a23] | 30 | try { |
---|
| 31 | for ( ;; ) { |
---|
| 32 | if ( done ) break; |
---|
| 33 | remove( *ping ); |
---|
| 34 | insert( *pong, 1 ); |
---|
| 35 | total_operations++; |
---|
| 36 | } |
---|
| 37 | } catch ( channel_closed * e ) {} |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | |
---|
[10b5970] | 41 | int main() { |
---|
[9319a23] | 42 | sout | "start"; |
---|
| 43 | processor proc[1]; |
---|
| 44 | |
---|
| 45 | Channel pingChan{ 1 }; |
---|
| 46 | Channel pongChan{ 1 }; |
---|
| 47 | |
---|
| 48 | ping = &pingChan; |
---|
| 49 | pong = &pongChan; |
---|
| 50 | |
---|
| 51 | { |
---|
| 52 | Ping pi; |
---|
| 53 | Pong po; |
---|
| 54 | sleep(10`s); |
---|
| 55 | done = true; |
---|
| 56 | close( *pong ); |
---|
| 57 | close( *ping ); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | // sout | total_operations; |
---|
| 61 | |
---|
| 62 | sout | "done"; |
---|
| 63 | return 0; |
---|
| 64 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.