|
Last change
on this file since 8f250e0 was 10b5970, checked in by Michael Brooks <mlbrooks@…>, 10 months 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:
811 bytes
|
| Line | |
|---|
| 1 | #include <fstream.hfa>
|
|---|
| 2 | #include <kernel.hfa>
|
|---|
| 3 | #include <locks.hfa>
|
|---|
| 4 | #include <stdlib.hfa>
|
|---|
| 5 | #include <thread.hfa>
|
|---|
| 6 |
|
|---|
| 7 | thread First { semaphore* lock; };
|
|---|
| 8 | thread Second { semaphore* lock; };
|
|---|
| 9 |
|
|---|
| 10 | void ?{}( First & this, semaphore & lock ) { ((thread&)this){ "Thread 1" }; this.lock = &lock; }
|
|---|
| 11 | void ?{}( Second & this, semaphore & lock ) { ((thread&)this){ "Thread 2" }; this.lock = &lock; }
|
|---|
| 12 |
|
|---|
| 13 | void main(First& this) {
|
|---|
| 14 | for(int i = 0; i < 10; i++) {
|
|---|
| 15 | sout | "First : Suspend No." | i + 1;
|
|---|
| 16 | yield();
|
|---|
| 17 | }
|
|---|
| 18 | V(*this.lock);
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | void main(Second& this) {
|
|---|
| 22 | P(*this.lock);
|
|---|
| 23 | for(int i = 0; i < 10; i++) {
|
|---|
| 24 | sout | "Second : Suspend No." | i + 1;
|
|---|
| 25 | yield();
|
|---|
| 26 | }
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | int main() {
|
|---|
| 31 | semaphore lock = { 0 };
|
|---|
| 32 | sout | "User main begin";
|
|---|
| 33 | {
|
|---|
| 34 | processor p;
|
|---|
| 35 | {
|
|---|
| 36 | First f = { lock };
|
|---|
| 37 | Second s = { lock };
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
| 40 | sout | "User main end";
|
|---|
| 41 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.