- File:
-
- 1 edited
-
libcfa/src/concurrency/preemption.cfa (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/preemption.cfa
rc1ee231 r8e9e9a2 37 37 // FwdDeclarations : timeout handlers 38 38 static void preempt( processor * this ); 39 static void timeout( $thread * this );39 static void timeout( struct __processor_id_t * id, $thread * this ); 40 40 41 41 // FwdDeclarations : Signal handlers … … 88 88 89 89 // Tick one frame of the Discrete Event Simulation for alarms 90 static void tick_preemption( ) {90 static void tick_preemption( struct __processor_id_t * id ) { 91 91 alarm_node_t * node = 0p; // Used in the while loop but cannot be declared in the while condition 92 92 alarm_list_t * alarms = &event_kernel->alarms; // Local copy for ease of reading … … 106 106 } 107 107 else { 108 timeout( node->thrd );108 timeout( id, node->thrd ); 109 109 } 110 110 … … 119 119 // If there are still alarms pending, reset the timer 120 120 if( & (*alarms)`first ) { 121 __cfa abi_dbg_print_buffer_decl(" KERNEL: @%ju(%ju) resetting alarm to %ju.\n", currtime.tv, __kernel_get_time().tv, (alarms->head->alarm - currtime).tv);121 __cfadbg_print_buffer_decl(preemption, " KERNEL: @%ju(%ju) resetting alarm to %ju.\n", currtime.tv, __kernel_get_time().tv, (alarms->head->alarm - currtime).tv); 122 122 Duration delta = (*alarms)`first.alarm - currtime; 123 123 Duration capped = max(delta, 50`us); … … 186 186 void enable_interrupts( __cfaabi_dbg_ctx_param ) { 187 187 processor * proc = kernelTLS.this_processor; // Cache the processor now since interrupts can start happening after the atomic store 188 /* paranoid */ verify( proc ); 188 189 189 190 with( kernelTLS.preemption_state ){ … … 266 267 267 268 // reserved for future use 268 static void timeout( $thread * this ) { 269 __unpark( this __cfaabi_dbg_ctx2 ); 269 static void timeout( struct __processor_id_t * id, $thread * this ) { 270 #if !defined( __CFA_NO_STATISTICS__ ) 271 kernelTLS.this_stats = this->curr_cluster->stats; 272 #endif 273 __unpark( id, this __cfaabi_dbg_ctx2 ); 270 274 } 271 275 … … 403 407 // Waits on SIGALRM and send SIGUSR1 to whom ever needs it 404 408 static void * alarm_loop( __attribute__((unused)) void * args ) { 409 __processor_id_t id; 410 id.id = doregister(&id); 411 405 412 // Block sigalrms to control when they arrive 406 413 sigset_t mask; … … 447 454 // __cfaabi_dbg_print_safe( "Kernel : Preemption thread tick\n" ); 448 455 lock( event_kernel->lock __cfaabi_dbg_ctx2 ); 449 tick_preemption( );456 tick_preemption( &id ); 450 457 unlock( event_kernel->lock ); 451 458 break; … … 460 467 EXIT: 461 468 __cfaabi_dbg_print_safe( "Kernel : Preemption thread stopping\n" ); 469 unregister(&id); 462 470 return 0p; 463 471 }
Note:
See TracChangeset
for help on using the changeset viewer.