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