Changeset 28e58fd for src/libcfa/concurrency/thread.c
- Timestamp:
- Aug 25, 2017, 10:38:34 AM (8 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/thread.c
raf08051 r28e58fd 32 32 // Thread ctors and dtors 33 33 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;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; 40 40 41 this ->current_monitors = &this->mon;42 this ->current_monitor_count = 1;41 this.current_monitors = &this.mon; 42 this.current_monitor_count = 1; 43 43 } 44 44 45 void ^?{}(thread_desc *this) {46 ^( &this->cor){};45 void ^?{}(thread_desc& this) { 46 ^(this.cor){}; 47 47 } 48 48 49 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T *); } )50 void ?{}( scoped(T) *this ) {51 ( &this->handle){};52 __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); 53 53 } 54 54 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);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); 59 59 } 60 60 61 61 forall( dtype T | sized(T) | is_thread(T) ) 62 void ^?{}( scoped(T) *this ) {63 ^( &this->handle){};62 void ^?{}( scoped(T)& this ) { 63 ^(this.handle){}; 64 64 } 65 65 … … 67 67 // Starting and stopping threads 68 68 forall( dtype T | is_thread(T) ) 69 void __thrd_start( T *this ) {69 void __thrd_start( T& this ) { 70 70 coroutine_desc* thrd_c = get_coroutine(this); 71 71 thread_desc* thrd_h = get_thread (this); … … 77 77 create_stack(&thrd_c->stack, thrd_c->stack.size); 78 78 this_coroutine = thrd_c; 79 CtxStart( this, CtxInvokeThread);79 CtxStart(&this, CtxInvokeThread); 80 80 assert( thrd_c->last->stack.context ); 81 81 CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
Note:
See TracChangeset
for help on using the changeset viewer.