- File:
-
- 1 edited
-
libcfa/src/concurrency/preemption.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/preemption.cfa
r4b30e8cc re873838 38 38 // FwdDeclarations : timeout handlers 39 39 static void preempt( processor * this ); 40 static void timeout( struct __processor_id_t * id,$thread * this );40 static void timeout( $thread * this ); 41 41 42 42 // FwdDeclarations : Signal handlers … … 91 91 92 92 // Tick one frame of the Discrete Event Simulation for alarms 93 static void tick_preemption( struct __processor_id_t * id) {93 static void tick_preemption(void) { 94 94 alarm_node_t * node = 0p; // Used in the while loop but cannot be declared in the while condition 95 95 alarm_list_t * alarms = &event_kernel->alarms; // Local copy for ease of reading … … 105 105 106 106 // Check if this is a kernel 107 if( node-> type == Kernel) {107 if( node->kernel_alarm ) { 108 108 preempt( node->proc ); 109 109 } 110 else if( node->type == User ) {111 timeout( id, node->thrd );112 }113 110 else { 114 bool unpark_thd = node->callback(*node); 115 if (unpark_thd) timeout( id, node->thrd ); 111 timeout( node->thrd ); 116 112 } 117 113 … … 274 270 275 271 // reserved for future use 276 static void timeout( struct __processor_id_t * id,$thread * this ) {272 static void timeout( $thread * this ) { 277 273 #if !defined( __CFA_NO_STATISTICS__ ) 278 274 kernelTLS.this_stats = this->curr_cluster->stats; 279 275 #endif 280 __unpark( id,this );276 unpark( this ); 281 277 } 282 278 … … 417 413 id.full_proc = false; 418 414 id.id = doregister(&id); 415 kernelTLS.this_proc_id = &id; 419 416 420 417 // Block sigalrms to control when they arrive … … 462 459 // __cfaabi_dbg_print_safe( "Kernel : Preemption thread tick\n" ); 463 460 lock( event_kernel->lock __cfaabi_dbg_ctx2 ); 464 tick_preemption( &id);461 tick_preemption(); 465 462 unlock( event_kernel->lock ); 466 463 break;
Note:
See TracChangeset
for help on using the changeset viewer.