Changes in / [eb7f20c:c659968]
- Location:
- src/libcfa/concurrency
- Files:
-
- 3 edited
-
kernel.c (modified) (1 diff)
-
kernel_private.h (modified) (1 diff)
-
preemption.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel.c
reb7f20c rc659968 170 170 if( ! do_terminate ) { 171 171 __cfaabi_dbg_print_safe("Kernel : core %p signaling termination\n", &this); 172 terminate(&this);172 do_terminate = true; 173 173 P( terminated ); 174 174 pthread_join( kernel_thread, NULL ); -
src/libcfa/concurrency/kernel_private.h
reb7f20c rc659968 60 60 void runThread(processor * this, thread_desc * dst); 61 61 void finishRunning(processor * this); 62 void terminate(processor * this);63 62 void spin(processor * this, unsigned int * spin_count); 64 63 -
src/libcfa/concurrency/preemption.c
reb7f20c rc659968 67 67 } 68 68 69 enum {70 PREEMPT_NORMAL = 0,71 PREEMPT_TERMINATE = 1,72 };73 74 69 //============================================================================================= 75 70 // Kernel Preemption logic … … 214 209 // kill wrapper : signal a processor 215 210 static void preempt( processor * this ) { 216 sigval_t value = { PREEMPT_NORMAL }; 217 pthread_sigqueue( this->kernel_thread, SIGUSR1, value ); 218 } 219 220 // kill wrapper : signal a processor 221 void terminate(processor * this) { 222 this->do_terminate = true; 223 sigval_t value = { PREEMPT_TERMINATE }; 224 pthread_sigqueue( this->kernel_thread, SIGUSR1, value ); 211 pthread_kill( this->kernel_thread, SIGUSR1 ); 225 212 } 226 213 … … 311 298 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) { 312 299 __cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.CFA_REG_IP); ) 313 314 // SKULLDUGGERY: if a thread creates a processor and the immediately deletes it,315 // the interrupt that is supposed to force the kernel thread to preempt might arrive316 // before the kernel thread has even started running. When that happens an iterrupt317 // we a null 'this_processor' will be caught, just ignore it.318 if(!this_processor) return;319 320 choose(sfp->si_value.sival_int) {321 case PREEMPT_NORMAL : ;// Normal case, nothing to do here322 case PREEMPT_TERMINATE: verify(this_processor->do_terminate);323 default:324 abortf( "internal error, signal value is %d", sfp->si_value.sival_int );325 }326 300 327 301 // Check if it is safe to preempt here
Note:
See TracChangeset
for help on using the changeset viewer.