Changeset 8e4aa05 for libcfa/src/concurrency/preemption.cfa
- Timestamp:
- Mar 4, 2021, 7:40:25 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 77d601f
- Parents:
- 342af53 (diff), a5040fe (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
r342af53 r8e4aa05 424 424 static void timeout( $thread * this ) { 425 425 unpark( this ); 426 } 427 428 void __disable_interrupts_hard() { 429 sigset_t oldset; 430 int ret; 431 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 432 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 433 434 ret = sigismember(&oldset, SIGUSR1); 435 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 436 if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); } 437 438 ret = sigismember(&oldset, SIGALRM); 439 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 440 if(ret == 0) { abort("ERROR SIGALRM is enabled"); } 441 442 signal_block( SIGUSR1 ); 443 } 444 445 void __enable_interrupts_hard() { 446 signal_unblock( SIGUSR1 ); 447 448 sigset_t oldset; 449 int ret; 450 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 451 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 452 453 ret = sigismember(&oldset, SIGUSR1); 454 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 455 if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); } 456 457 ret = sigismember(&oldset, SIGALRM); 458 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 459 if(ret == 0) { abort("ERROR SIGALRM is enabled"); } 426 460 } 427 461 … … 551 585 552 586 // Setup proper signal handlers 553 __cfaabi_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART); // __cfactx_switch handler554 __cfaabi_sigaction( SIGALRM, sigHandler_alarm , SA_SIGINFO | SA_RESTART); // debug handler587 __cfaabi_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO ); // __cfactx_switch handler 588 __cfaabi_sigaction( SIGALRM, sigHandler_alarm , SA_SIGINFO ); // debug handler 555 589 556 590 signal_block( SIGALRM ); … … 580 614 581 615 __cfaabi_dbg_print_safe( "Kernel : Preemption stopped\n" ); 616 } 617 618 // Prevent preemption since we are about to start terminating things 619 void __kernel_abort_lock(void) { 620 signal_block( SIGUSR1 ); 582 621 } 583 622
Note:
See TracChangeset
for help on using the changeset viewer.