Ignore:
Timestamp:
Feb 13, 2017, 5:13:11 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
eafb094
Parents:
db6f06a
Message:

Made some clean-up and removed redundant coroutine state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/thread.c

    rdb6f06a ree897e4b  
    44#include <threads>
    55
    6 struct First { thread t; simple_lock* lock; };
    7 struct Second { thread t; simple_lock* lock; };
     6struct First { thread t; signal_once* lock; };
     7struct Second { thread t; signal_once* lock; };
    88
    99DECL_THREAD(First);
    1010DECL_THREAD(Second);
    1111
    12 void ?{}( First * this, simple_lock* lock ) { this->lock = lock; }
    13 void ?{}( Second * this, simple_lock* lock ) { this->lock = lock; }
     12void ?{}( First * this, signal_once* lock ) { this->lock = lock; }
     13void ?{}( Second * this, signal_once* lock ) { this->lock = lock; }
    1414
    1515void main(First* this) {
     
    1818                yield();
    1919        }
    20         unlock(this->lock);
     20        signal(this->lock);
    2121}
    2222
    2323void main(Second* this) {
    24         lock(this->lock);       
     24        wait(this->lock);
    2525        for(int i = 0; i < 10; i++) {
    2626                sout | "Second : Suspend No." | i + 1 | endl;
     
    3131
    3232int main(int argc, char* argv[]) {
    33         simple_lock lock;
     33        signal_once lock;
    3434        sout | "User main begin" | endl;
    3535        {
    36                 // processor p;
     36                processor p;
    3737                {
    3838                        scoped(First)  f = { &lock };
Note: See TracChangeset for help on using the changeset viewer.