- File:
-
- 1 edited
-
libcfa/src/concurrency/preemption.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/preemption.cfa
rbecb85b9 re84ab3d 251 251 bool enabled = __cfaabi_tls.preemption_state.enabled; 252 252 253 // Check if there is a pending preemption254 processor * proc = __cfaabi_tls.this_processor;255 bool pending = proc ? proc->pending_preemption : false;256 if( enabled && pending ) proc->pending_preemption = false;257 258 253 // create a assembler label after 259 254 // marked as clobber all to avoid movement 260 255 __cfaasm_label(check, after); 261 262 // If we can preempt and there is a pending one263 // this is a good time to yield264 if( enabled && pending ) {265 force_yield( __POLL_PREEMPTION );266 }267 256 return enabled; 268 257 } … … 293 282 // marked as clobber all to avoid movement 294 283 __cfaasm_label(get, after); 295 296 // This is used everywhere, to avoid cost, we DO NOT poll pending preemption297 284 return val; 298 285 } … … 371 358 if(!ready) { abort("Preemption should be ready"); } 372 359 373 //__cfaasm_label(debug, before);360 __cfaasm_label(debug, before); 374 361 375 362 sigset_t oldset; … … 390 377 if(ret == 1) { abort("ERROR SIGTERM is disabled"); } 391 378 392 //__cfaasm_label(debug, after);379 __cfaasm_label(debug, after); 393 380 } 394 381 … … 561 548 __cfaasm_label( check ); 562 549 __cfaasm_label( dsable ); 563 //__cfaasm_label( debug );550 __cfaasm_label( debug ); 564 551 565 552 // Check if preemption is safe … … 568 555 if( __cfaasm_in( ip, check ) ) { ready = false; goto EXIT; }; 569 556 if( __cfaasm_in( ip, dsable ) ) { ready = false; goto EXIT; }; 570 //if( __cfaasm_in( ip, debug ) ) { ready = false; goto EXIT; };557 if( __cfaasm_in( ip, debug ) ) { ready = false; goto EXIT; }; 571 558 if( !__cfaabi_tls.preemption_state.enabled) { ready = false; goto EXIT; }; 572 559 if( __cfaabi_tls.preemption_state.in_progress ) { ready = false; goto EXIT; }; … … 674 661 675 662 // Check if it is safe to preempt here 676 if( !preemption_ready( ip ) ) { 677 #if !defined(__CFA_NO_STATISTICS__) 678 __cfaabi_tls.this_stats->ready.threads.preempt.rllfwd++; 679 #endif 680 return; 681 } 663 if( !preemption_ready( ip ) ) { return; } 682 664 683 665 __cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p @ %p).\n", __cfaabi_tls.this_processor, __cfaabi_tls.this_thread, (void *)(cxt->uc_mcontext.CFA_REG_IP) ); … … 698 680 699 681 // Preemption can occur here 700 701 #if !defined(__CFA_NO_STATISTICS__)702 __cfaabi_tls.this_stats->ready.threads.preempt.yield++;703 #endif704 682 705 683 force_yield( __ALARM_PREEMPTION ); // Do the actual __cfactx_switch
Note:
See TracChangeset
for help on using the changeset viewer.