- File:
-
- 1 edited
-
src/libcfa/concurrency/threads.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/threads.c
rbd98b58 r8def349 27 27 } 28 28 29 /*thread_local*/ extern processor * this_processor;29 extern processor * get_this_processor(); 30 30 31 31 //----------------------------------------------------------------------------- 32 32 // Forward declarations 33 forall( otype T| is_thread(T) )33 forall( dtype T | sized(T) | is_thread(T) ) 34 34 void start( T* this ); 35 35 36 forall( otype T| is_thread(T) )36 forall( dtype T | sized(T) | is_thread(T) ) 37 37 void stop( T* this ); 38 38 … … 42 42 void ?{}(thread_h* this) { 43 43 (&this->c){}; 44 this->c.name = "Anonymous Coroutine"; 44 45 (&this->lock){}; 45 46 this->next = NULL; … … 50 51 } 51 52 52 forall( otype T | is_thread(T))53 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } ) 53 54 void ?{}( thread(T)* this ) { 54 55 (&this->handle){}; … … 56 57 } 57 58 58 forall( otype T, ttype P| is_thread(T) | { void ?{}(T*, P); } )59 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } ) 59 60 void ?{}( thread(T)* this, P params ) { 60 61 (&this->handle){ params }; … … 62 63 } 63 64 64 forall( otype T | is_thread(T))65 forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } ) 65 66 void ^?{}( thread(T)* this ) { 66 67 stop(&this->handle); … … 77 78 extern void thread_schedule( thread_h * ); 78 79 79 forall( otype T | is_thread(T))80 forall( dtype T | sized(T) | is_thread(T) ) 80 81 void start( T* this ) { 81 82 coroutine* thrd_c = get_coroutine(this); 82 83 thread_h* thrd_h = get_thread (this); 83 84 thrd_c->last = this_coroutine(); 84 this_processor->current_coroutine = thrd_c;85 get_this_processor()->current_coroutine = thrd_c; 85 86 86 87 // LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", handle, thrd_c, thrd_h); … … 93 94 } 94 95 95 forall( otype T| is_thread(T) )96 forall( dtype T | sized(T) | is_thread(T) ) 96 97 void stop( T* this ) { 97 98 thread_h* thrd = get_thread(this);
Note:
See TracChangeset
for help on using the changeset viewer.