Changes in src/libcfa/concurrency/thread.c [9c31349:17af7d1]
- File:
-
- 1 edited
-
src/libcfa/concurrency/thread.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/thread.c
r9c31349 r17af7d1 35 35 void start( T* this ); 36 36 37 forall( dtype T | is_thread(T) ) 38 void stop( T* this ); 39 37 40 //----------------------------------------------------------------------------- 38 41 // Thread ctors and dtors … … 41 44 (&this->cor){}; 42 45 this->cor.name = "Anonymous Coroutine"; 43 this->mon.owner = this; 44 this->mon.recursion = 1; 46 (&this->terminated){}; 45 47 this->next = NULL; 46 48 } … … 64 66 forall( dtype T | sized(T) | is_thread(T) ) 65 67 void ^?{}( scoped(T)* this ) { 68 stop(&this->handle); 66 69 ^(&this->handle){}; 67 70 } … … 83 86 84 87 ScheduleThread(thrd_h); 88 } 89 90 forall( dtype T | is_thread(T) ) 91 void stop( T* this ) { 92 wait( & get_thread(this)->terminated ); 85 93 } 86 94 … … 108 116 } 109 117 118 // C Helper to signal the termination of a thread_desc 119 // Used in invoke.c 120 extern "C" { 121 void __thread_signal_termination( thread_desc * this ) { 122 this->cor.state = Halted; 123 LIB_DEBUG_PRINTF("Thread end : %p\n", this); 124 signal( &this->terminated ); 125 } 126 } 127 110 128 // Local Variables: // 111 129 // mode: c //
Note:
See TracChangeset
for help on using the changeset viewer.