Ignore:
File:
1 edited

Legend:

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

    r83a071f9 r6b0b624  
    1 //                              -*- Mode: CFA -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    109// Author           : Thierry Delisle
    1110// Created On       : Tue Jan 17 12:27:26 2017
    12 // Last Modified By : Thierry Delisle
    13 // Last Modified On : --
    14 // Update Count     : 0
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Jul 21 22:34:46 2017
     13// Update Count     : 1
    1514//
    1615
     
    3332// Thread ctors and dtors
    3433
    35 void ?{}(thread_desc& this) {
    36         (this.cor){};
    37         this.cor.name = "Anonymous Coroutine";
    38         this.mon.owner = &this;
    39         this.mon.recursion = 1;
    40         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;
    4140
    42         this.current_monitors      = &this.mon;
    43         this.current_monitor_count = 1;
     41        this->current_monitors      = &this->mon;
     42        this->current_monitor_count = 1;
    4443}
    4544
    46 void ^?{}(thread_desc& this) {
    47         ^(this.cor){};
     45void ^?{}(thread_desc* this) {
     46        ^(&this->cor){};
    4847}
    4948
    50 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
    51 void ?{}( scoped(T)& this ) {
    52         (this.handle){};
    53         __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);
    5453}
    5554
    56 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
    57 void ?{}( scoped(T)& this, P params ) {
    58         (this.handle){ params };
    59         __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);
    6059}
    6160
    6261forall( dtype T | sized(T) | is_thread(T) )
    63 void ^?{}( scoped(T)& this ) {
    64         ^(this.handle){};
     62void ^?{}( scoped(T)* this ) {
     63        ^(&this->handle){};
    6564}
    6665
     
    6867// Starting and stopping threads
    6968forall( dtype T | is_thread(T) )
    70 void __thrd_start( T& this ) {
     69void __thrd_start( T* this ) {
    7170        coroutine_desc* thrd_c = get_coroutine(this);
    7271        thread_desc*  thrd_h = get_thread   (this);
     
    7877        create_stack(&thrd_c->stack, thrd_c->stack.size);
    7978        this_coroutine = thrd_c;
    80         CtxStart(&this, CtxInvokeThread);
     79        CtxStart(this, CtxInvokeThread);
    8180        assert( thrd_c->last->stack.context );
    8281        CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
     
    8786
    8887void yield( void ) {
    89         BlockInternal( (thread_desc *)this_thread );
     88        BlockInternal( this_thread );
    9089}
    9190
Note: See TracChangeset for help on using the changeset viewer.