Changes in src/tests/thread.c [bd4d011:f3c1737]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/thread.c
rbd4d011 rf3c1737 4 4 #include <thread> 5 5 6 // thread First;7 // void main(First* this);6 thread First { semaphore* lock; }; 7 thread Second { semaphore* lock; }; 8 8 9 // thread Second; 10 // void main(Second* this); 11 12 thread First { signal_once* lock; }; 13 thread Second { signal_once* lock; }; 14 15 void ?{}( First * this, signal_once* lock ) { this->lock = lock; } 16 void ?{}( Second * this, signal_once* lock ) { this->lock = lock; } 9 void ?{}( First * this, semaphore* lock ) { this->lock = lock; } 10 void ?{}( Second * this, semaphore* lock ) { this->lock = lock; } 17 11 18 12 void main(First* this) { … … 21 15 yield(); 22 16 } 23 signal(this->lock);17 V(this->lock); 24 18 } 25 19 26 20 void main(Second* this) { 27 wait(this->lock);21 P(this->lock); 28 22 for(int i = 0; i < 10; i++) { 29 23 sout | "Second : Suspend No." | i + 1 | endl; … … 34 28 35 29 int main(int argc, char* argv[]) { 36 s ignal_once lock;30 semaphore lock = { 0 }; 37 31 sout | "User main begin" | endl; 38 32 {
Note: See TracChangeset
for help on using the changeset viewer.