rtems: Simplify rtems_signal_catch()

In uniprocessor configurations, we can simplify rtems_signal_catch().
Add a validation test for the SMP special case.
This commit is contained in:
Sebastian Huber
2021-03-02 21:46:52 +01:00
parent 9a13f3796a
commit 83b1b25d4c
2 changed files with 568 additions and 101 deletions
+19 -1
View File
@@ -58,17 +58,35 @@ rtems_status_code rtems_signal_catch(
asr->handler = asr_handler;
asr->mode_set = mode_set;
#if defined(RTEMS_SMP)
if ( asr_handler == NULL ) {
Chain_Node *node;
asr->signals_pending = 0;
/*
* In SMP configurations, signals may be sent on other processors
* (interrupts or threads) in parallel. This will cause an inter-processor
* interrupt which may be blocked by the above interrupt disable.
*/
node = &api->Signal_action.Node;
_Assert( asr->signals_pending == 0 || !_Chain_Is_node_off_chain( node ) );
_Assert( asr->signals_pending != 0 || _Chain_Is_node_off_chain( node ) );
if ( !_Chain_Is_node_off_chain( node ) ) {
asr->signals_pending = 0;
_Chain_Extract_unprotected( node );
_Chain_Set_off_chain( node );
}
}
#else
/*
* In uniprocessor configurations, as soon as interrupts are disabled above
* nobody can send signals to the executing thread. So, pending signals at
* this point cannot appear.
*/
_Assert( asr->signals_pending == 0 );
_Assert( _Chain_Is_node_off_chain( &api->Signal_action.Node ) );
#endif
_Thread_State_release( executing, &lock_context );
return RTEMS_SUCCESSFUL;
File diff suppressed because it is too large Load Diff