forked from Imagelibrary/rtems
posix: Add signal post switch extension on the fly
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include <rtems/posix/psignal.h>
|
#include <rtems/posix/psignal.h>
|
||||||
#include <rtems/posix/pthread.h>
|
#include <rtems/posix/pthread.h>
|
||||||
#include <rtems/posix/sigset.h>
|
#include <rtems/posix/sigset.h>
|
||||||
|
#include <rtems/score/apiext.h>
|
||||||
|
|
||||||
#define _States_Is_interruptible_signal( _states ) \
|
#define _States_Is_interruptible_signal( _states ) \
|
||||||
( ((_states) & \
|
( ((_states) & \
|
||||||
@@ -56,15 +57,18 @@ extern Chain_Control _POSIX_signals_Inactive_siginfo;
|
|||||||
|
|
||||||
extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
|
extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
|
||||||
|
|
||||||
|
extern API_extensions_Post_switch_control _POSIX_signals_Post_switch;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal routines
|
* Internal routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _POSIX_signals_Manager_Initialization(void);
|
void _POSIX_signals_Manager_Initialization(void);
|
||||||
|
|
||||||
void _POSIX_signals_Post_switch_extension(
|
static inline void _POSIX_signals_Add_post_switch_extension(void)
|
||||||
Thread_Control *the_thread
|
{
|
||||||
);
|
_API_extensions_Add_post_switch( &_POSIX_signals_Post_switch );
|
||||||
|
}
|
||||||
|
|
||||||
bool _POSIX_signals_Unblock_thread(
|
bool _POSIX_signals_Unblock_thread(
|
||||||
Thread_Control *the_thread,
|
Thread_Control *the_thread,
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ int killinfo(
|
|||||||
|
|
||||||
_Thread_Disable_dispatch();
|
_Thread_Disable_dispatch();
|
||||||
|
|
||||||
|
_POSIX_signals_Add_post_switch_extension();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is the currently executing thread interested? If so then it will
|
* Is the currently executing thread interested? If so then it will
|
||||||
* get it an execute it as soon as the dispatcher executes.
|
* get it an execute it as soon as the dispatcher executes.
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ Watchdog_Control _POSIX_signals_Ualarm_timer;
|
|||||||
* _POSIX_signals_Post_switch_extension
|
* _POSIX_signals_Post_switch_extension
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _POSIX_signals_Post_switch_extension(
|
static void _POSIX_signals_Post_switch_hook(
|
||||||
Thread_Control *the_thread
|
Thread_Control *the_thread
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -158,6 +158,10 @@ void _POSIX_signals_Post_switch_extension(
|
|||||||
_Thread_Executing->Wait.return_code = hold_errno;
|
_Thread_Executing->Wait.return_code = hold_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_extensions_Post_switch_control _POSIX_signals_Post_switch = {
|
||||||
|
.hook = _POSIX_signals_Post_switch_hook
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _POSIX_signals_Manager_Initialization
|
* _POSIX_signals_Manager_Initialization
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -311,10 +311,6 @@ API_extensions_Control _POSIX_Threads_API_extensions = {
|
|||||||
.postdriver_hook = _POSIX_Threads_Initialize_user_threads
|
.postdriver_hook = _POSIX_Threads_Initialize_user_threads
|
||||||
};
|
};
|
||||||
|
|
||||||
API_extensions_Post_switch_control _POSIX_Threads_API_extensions_post_switch = {
|
|
||||||
.hook = _POSIX_signals_Post_switch_extension
|
|
||||||
};
|
|
||||||
|
|
||||||
User_extensions_Control _POSIX_Threads_User_extensions = {
|
User_extensions_Control _POSIX_Threads_User_extensions = {
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
{ { NULL, NULL }, NULL },
|
{ { NULL, NULL }, NULL },
|
||||||
@@ -359,7 +355,6 @@ void _POSIX_Threads_Manager_initialization(void)
|
|||||||
_User_extensions_Add_API_set( &_POSIX_Threads_User_extensions );
|
_User_extensions_Add_API_set( &_POSIX_Threads_User_extensions );
|
||||||
|
|
||||||
_API_extensions_Add( &_POSIX_Threads_API_extensions );
|
_API_extensions_Add( &_POSIX_Threads_API_extensions );
|
||||||
_API_extensions_Add_post_switch( &_POSIX_Threads_API_extensions_post_switch );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we supported MP, then here we would ...
|
* If we supported MP, then here we would ...
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ int pthread_kill(
|
|||||||
* If sig == 0 then just validate arguments
|
* If sig == 0 then just validate arguments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
_POSIX_signals_Add_post_switch_extension();
|
||||||
|
|
||||||
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
if ( sig ) {
|
if ( sig ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user