Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/thread.c

    rbd4d011 rf3c1737  
    44#include <thread>
    55
    6 // thread First;
    7 // void main(First* this);
     6thread First  { semaphore* lock; };
     7thread Second { semaphore* lock; };
    88
    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; }
     9void ?{}( First * this, semaphore* lock ) { this->lock = lock; }
     10void ?{}( Second * this, semaphore* lock ) { this->lock = lock; }
    1711
    1812void main(First* this) {
     
    2115                yield();
    2216        }
    23         signal(this->lock);
     17        V(this->lock);
    2418}
    2519
    2620void main(Second* this) {
    27         wait(this->lock);
     21        P(this->lock);
    2822        for(int i = 0; i < 10; i++) {
    2923                sout | "Second : Suspend No." | i + 1 | endl;
     
    3428
    3529int main(int argc, char* argv[]) {
    36         signal_once lock;
     30        semaphore lock = { 0 };
    3731        sout | "User main begin" | endl;
    3832        {
Note: See TracChangeset for help on using the changeset viewer.