Ignore:
Timestamp:
Aug 25, 2017, 10:38:34 AM (8 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:
800d275
Parents:
af08051 (diff), 3eab308c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/thread.c

    raf08051 r28e58fd  
    3232// Thread ctors and dtors
    3333
    34 void ?{}(thread_desc* this) {
    35         (&this->cor){};
    36         this->cor.name = "Anonymous Coroutine";
    37         this->mon.owner = this;
    38         this->mon.recursion = 1;
    39         this->next = NULL;
     34void ?{}(thread_desc& this) {
     35        (this.cor){};
     36        this.cor.name = "Anonymous Coroutine";
     37        this.mon.owner = &this;
     38        this.mon.recursion = 1;
     39        this.next = NULL;
    4040
    41         this->current_monitors      = &this->mon;
    42         this->current_monitor_count = 1;
     41        this.current_monitors      = &this.mon;
     42        this.current_monitor_count = 1;
    4343}
    4444
    45 void ^?{}(thread_desc* this) {
    46         ^(&this->cor){};
     45void ^?{}(thread_desc& this) {
     46        ^(this.cor){};
    4747}
    4848
    49 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
    50 void ?{}( scoped(T)* this ) {
    51         (&this->handle){};
    52         __thrd_start(&this->handle);
     49forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
     50void ?{}( scoped(T)& this ) {
     51        (this.handle){};
     52        __thrd_start(this.handle);
    5353}
    5454
    55 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
    56 void ?{}( scoped(T)* this, P params ) {
    57         (&this->handle){ params };
    58         __thrd_start(&this->handle);
     55forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
     56void ?{}( scoped(T)& this, P params ) {
     57        (this.handle){ params };
     58        __thrd_start(this.handle);
    5959}
    6060
    6161forall( dtype T | sized(T) | is_thread(T) )
    62 void ^?{}( scoped(T)* this ) {
    63         ^(&this->handle){};
     62void ^?{}( scoped(T)& this ) {
     63        ^(this.handle){};
    6464}
    6565
     
    6767// Starting and stopping threads
    6868forall( dtype T | is_thread(T) )
    69 void __thrd_start( T* this ) {
     69void __thrd_start( T& this ) {
    7070        coroutine_desc* thrd_c = get_coroutine(this);
    7171        thread_desc*  thrd_h = get_thread   (this);
     
    7777        create_stack(&thrd_c->stack, thrd_c->stack.size);
    7878        this_coroutine = thrd_c;
    79         CtxStart(this, CtxInvokeThread);
     79        CtxStart(&this, CtxInvokeThread);
    8080        assert( thrd_c->last->stack.context );
    8181        CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
Note: See TracChangeset for help on using the changeset viewer.