summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-14 11:58:12 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-31 08:29:43 +0200
commitfc521e2df6f4948da47ab26b90c4ce1ff56e3c19 (patch)
tree41727c47bd66803dcd9222c0bb835d0668447b4e
parent6fd1bdb7af578933f1aa8fb981a29c61df5dcde4 (diff)
downloadrtems-fc521e2df6f4948da47ab26b90c4ce1ff56e3c19.tar.bz2
posix: Use thread action for signals
-rw-r--r--cpukit/posix/include/rtems/posix/psignalimpl.h12
-rw-r--r--cpukit/posix/include/rtems/posix/threadsup.h5
-rw-r--r--cpukit/posix/src/killinfo.c2
-rw-r--r--cpukit/posix/src/psignal.c23
-rw-r--r--cpukit/posix/src/psignalunblockthread.c2
-rw-r--r--cpukit/posix/src/pthread.c5
-rw-r--r--cpukit/posix/src/pthreadkill.c2
7 files changed, 28 insertions, 23 deletions
diff --git a/cpukit/posix/include/rtems/posix/psignalimpl.h b/cpukit/posix/include/rtems/posix/psignalimpl.h
index 17ce19fd0e..81561e2539 100644
--- a/cpukit/posix/include/rtems/posix/psignalimpl.h
+++ b/cpukit/posix/include/rtems/posix/psignalimpl.h
@@ -69,8 +69,6 @@ extern Chain_Control _POSIX_signals_Inactive_siginfo;
extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
-extern API_extensions_Post_switch_control _POSIX_signals_Post_switch;
-
/*
* Internal routines
*/
@@ -86,10 +84,12 @@ void _POSIX_signals_Manager_Initialization(void);
#define _POSIX_signals_Release( lock_context ) \
_ISR_lock_Release_and_ISR_enable( &_POSIX_signals_Lock, lock_context )
-static inline void _POSIX_signals_Add_post_switch_extension(void)
-{
- _API_extensions_Add_post_switch( &_POSIX_signals_Post_switch );
-}
+void _POSIX_signals_Action_handler(
+ Thread_Control *executing,
+ Thread_Action *action,
+ Per_CPU_Control *cpu,
+ ISR_Level level
+);
/**
* @brief Unlock POSIX signals thread.
diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h
index e0b9ff55e9..46903fed98 100644
--- a/cpukit/posix/include/rtems/posix/threadsup.h
+++ b/cpukit/posix/include/rtems/posix/threadsup.h
@@ -68,6 +68,11 @@ typedef struct {
/** This is the set of signals which are currently pending. */
sigset_t signals_pending;
+ /**
+ * @brief Signal post-switch action in case signals are pending.
+ */
+ Thread_Action Signal_action;
+
/*******************************************************************/
/*******************************************************************/
/*************** POSIX Cancelability ***************/
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index fa4857da51..5d3dded53f 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -121,8 +121,6 @@ int killinfo(
_Thread_Disable_dispatch();
- _POSIX_signals_Add_post_switch_extension();
-
/*
* Is the currently executing thread interested? If so then it will
* get it an execute it as soon as the dispatcher executes.
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index 731a2300bd..0e2a018041 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -25,6 +25,7 @@
#include <rtems/score/isrlevel.h>
#include <rtems/score/statesimpl.h>
+#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
@@ -108,22 +109,22 @@ Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL))
-/*
- * _POSIX_signals_Post_switch_extension
- */
-
-static void _POSIX_signals_Post_switch_hook(
- Thread_Control *the_thread
+void _POSIX_signals_Action_handler(
+ Thread_Control *executing,
+ Thread_Action *action,
+ Per_CPU_Control *cpu,
+ ISR_Level level
)
{
POSIX_API_Control *api;
int signo;
ISR_lock_Context lock_context;
int hold_errno;
- Thread_Control *executing;
- executing = _Thread_Get_executing();
- api = the_thread->API_Extensions[ THREAD_API_POSIX ];
+ (void) action;
+ _Thread_Action_release_and_ISR_enable( cpu, level );
+
+ api = executing->API_Extensions[ THREAD_API_POSIX ];
/*
* We need to ensure that if the signal handler executes a call
@@ -169,10 +170,6 @@ static void _POSIX_signals_Post_switch_hook(
executing->Wait.return_code = hold_errno;
}
-API_extensions_Post_switch_control _POSIX_signals_Post_switch = {
- .hook = _POSIX_signals_Post_switch_hook
-};
-
void _POSIX_signals_Manager_Initialization(void)
{
uint32_t signo;
diff --git a/cpukit/posix/src/psignalunblockthread.c b/cpukit/posix/src/psignalunblockthread.c
index 2d6063b45a..c93dcfc1ce 100644
--- a/cpukit/posix/src/psignalunblockthread.c
+++ b/cpukit/posix/src/psignalunblockthread.c
@@ -47,6 +47,8 @@ bool _POSIX_signals_Unblock_thread(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
+ _Thread_Add_post_switch_action( the_thread, &api->Signal_action );
+
mask = signo_to_mask( signo );
/*
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 7968f17582..d2e637365e 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -233,6 +233,11 @@ static bool _POSIX_Threads_Create_extension(
api->signals_blocked = SIGNAL_ALL_MASK;
}
+ _Thread_Action_initialize(
+ &api->Signal_action,
+ _POSIX_signals_Action_handler
+ );
+
_Thread_queue_Initialize(
&api->Join_List,
THREAD_QUEUE_DISCIPLINE_FIFO,
diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c
index dce646b310..2e44dc61db 100644
--- a/cpukit/posix/src/pthreadkill.c
+++ b/cpukit/posix/src/pthreadkill.c
@@ -53,8 +53,6 @@ int pthread_kill(
* If sig == 0 then just validate arguments
*/
- _POSIX_signals_Add_post_switch_extension();
-
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
if ( sig ) {