- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/thread.c
r83a071f9 r6b0b624 1 // -*- Mode: CFA -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 10 9 // Author : Thierry Delisle 11 10 // Created On : Tue Jan 17 12:27:26 2017 12 // Last Modified By : Thierry Delisle13 // Last Modified On : --14 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:34:46 2017 13 // Update Count : 1 15 14 // 16 15 … … 33 32 // Thread ctors and dtors 34 33 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;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; 41 40 42 this .current_monitors = &this.mon;43 this .current_monitor_count = 1;41 this->current_monitors = &this->mon; 42 this->current_monitor_count = 1; 44 43 } 45 44 46 void ^?{}(thread_desc &this) {47 ^( this.cor){};45 void ^?{}(thread_desc* this) { 46 ^(&this->cor){}; 48 47 } 49 48 50 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T &); } )51 void ?{}( scoped(T) &this ) {52 ( this.handle){};53 __thrd_start( this.handle);49 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } ) 50 void ?{}( scoped(T)* this ) { 51 (&this->handle){}; 52 __thrd_start(&this->handle); 54 53 } 55 54 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);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); 60 59 } 61 60 62 61 forall( dtype T | sized(T) | is_thread(T) ) 63 void ^?{}( scoped(T) &this ) {64 ^( this.handle){};62 void ^?{}( scoped(T)* this ) { 63 ^(&this->handle){}; 65 64 } 66 65 … … 68 67 // Starting and stopping threads 69 68 forall( dtype T | is_thread(T) ) 70 void __thrd_start( T &this ) {69 void __thrd_start( T* this ) { 71 70 coroutine_desc* thrd_c = get_coroutine(this); 72 71 thread_desc* thrd_h = get_thread (this); … … 78 77 create_stack(&thrd_c->stack, thrd_c->stack.size); 79 78 this_coroutine = thrd_c; 80 CtxStart( &this, CtxInvokeThread);79 CtxStart(this, CtxInvokeThread); 81 80 assert( thrd_c->last->stack.context ); 82 81 CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context ); … … 87 86 88 87 void yield( void ) { 89 BlockInternal( (thread_desc *)this_thread );88 BlockInternal( this_thread ); 90 89 } 91 90
Note:
See TracChangeset
for help on using the changeset viewer.