Changeset 04e6f93 for libcfa/src/concurrency/preemption.cfa
- Timestamp:
- Feb 27, 2020, 4:04:25 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a037f85
- Parents:
- 41efd33 (diff), 930b504 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/preemption.cfa
r41efd33 r04e6f93 39 39 // FwdDeclarations : timeout handlers 40 40 static void preempt( processor * this ); 41 static void timeout( thread_desc* this );41 static void timeout( $thread * this ); 42 42 43 43 // FwdDeclarations : Signal handlers … … 184 184 185 185 // Enable interrupts by decrementing the counter 186 // If counter reaches 0, execute any pending CtxSwitch186 // If counter reaches 0, execute any pending __cfactx_switch 187 187 void enable_interrupts( __cfaabi_dbg_ctx_param ) { 188 188 processor * proc = kernelTLS.this_processor; // Cache the processor now since interrupts can start happening after the atomic store 189 thread_desc * thrd = kernelTLS.this_thread; // Cache the thread now since interrupts can start happening after the atomic store190 189 191 190 with( kernelTLS.preemption_state ){ … … 209 208 if( proc->pending_preemption ) { 210 209 proc->pending_preemption = false; 211 BlockInternal( thrd);210 force_yield( __POLL_PREEMPTION ); 212 211 } 213 212 } … … 219 218 220 219 // Disable interrupts by incrementint the counter 221 // Don't execute any pending CtxSwitch even if counter reaches 0220 // Don't execute any pending __cfactx_switch even if counter reaches 0 222 221 void enable_interrupts_noPoll() { 223 222 unsigned short prev = kernelTLS.preemption_state.disable_count; … … 268 267 269 268 // reserved for future use 270 static void timeout( thread_desc* this ) {269 static void timeout( $thread * this ) { 271 270 //TODO : implement waking threads 272 271 } 273 272 274 273 // KERNEL ONLY 275 // Check if a CtxSwitch signal handler shoud defer274 // Check if a __cfactx_switch signal handler shoud defer 276 275 // If true : preemption is safe 277 276 // If false : preemption is unsafe and marked as pending … … 303 302 304 303 // Setup proper signal handlers 305 __cfaabi_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART ); // CtxSwitch handler304 __cfaabi_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART ); // __cfactx_switch handler 306 305 307 306 signal_block( SIGALRM ); 308 307 309 alarm_stack = create_pthread( &alarm_thread, alarm_loop, 0p );308 alarm_stack = __create_pthread( &alarm_thread, alarm_loop, 0p ); 310 309 } 311 310 … … 394 393 // Preemption can occur here 395 394 396 BlockInternal( kernelTLS.this_thread ); // Do the actual CtxSwitch395 force_yield( __ALARM_PREEMPTION ); // Do the actual __cfactx_switch 397 396 } 398 397
Note:
See TracChangeset
for help on using the changeset viewer.