summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/sigtimedwait.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-27 14:43:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-30 16:16:21 +0200
commit93306058c0417b1c6e950b44ef279e096062dfba (patch)
tree1a3326d052169d2aec4c4acdd894589d5d84614c /cpukit/posix/src/sigtimedwait.c
parentscore: Add _Thread_queue_Context_set_MP_callout() (diff)
downloadrtems-93306058c0417b1c6e950b44ef279e096062dfba.tar.bz2
score: _CORE_mutex_Check_dispatch_for_seize()
Move the safety check performed by _CORE_mutex_Check_dispatch_for_seize() out of the performance critical path and generalize it. Blocking on a thread queue with an unexpected thread dispatch disabled level is illegal in all system states. Add the expected thread dispatch disable level (which may be 1 or 2 depending on the operation) to Thread_queue_Context and use it in _Thread_queue_Enqueue_critical().
Diffstat (limited to 'cpukit/posix/src/sigtimedwait.c')
-rw-r--r--cpukit/posix/src/sigtimedwait.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
index ddc2884d68..7855bb0080 100644
--- a/cpukit/posix/src/sigtimedwait.c
+++ b/cpukit/posix/src/sigtimedwait.c
@@ -69,14 +69,14 @@ int sigtimedwait(
const struct timespec *__restrict timeout
)
{
- Thread_Control *executing;
- POSIX_API_Control *api;
- Watchdog_Interval interval;
- siginfo_t signal_information;
- siginfo_t *the_info;
- int signo;
- ISR_lock_Context lock_context;
- int error;
+ Thread_Control *executing;
+ POSIX_API_Control *api;
+ Watchdog_Interval interval;
+ siginfo_t signal_information;
+ siginfo_t *the_info;
+ int signo;
+ Thread_queue_Context queue_context;
+ int error;
/*
* Error check parameters before disabling interrupts.
@@ -115,7 +115,8 @@ int sigtimedwait(
/* API signals pending? */
- _POSIX_signals_Acquire( &lock_context );
+ _Thread_queue_Context_initialize( &queue_context );
+ _POSIX_signals_Acquire( &queue_context );
if ( *set & api->signals_pending ) {
/* XXX real info later */
the_info->si_signo = _POSIX_signals_Get_lowest( api->signals_pending );
@@ -127,7 +128,7 @@ int sigtimedwait(
false,
false
);
- _POSIX_signals_Release( &lock_context );
+ _POSIX_signals_Release( &queue_context );
the_info->si_code = SI_USER;
the_info->si_value.sival_int = 0;
@@ -139,7 +140,7 @@ int sigtimedwait(
if ( *set & _POSIX_signals_Pending ) {
signo = _POSIX_signals_Get_lowest( _POSIX_signals_Pending );
_POSIX_signals_Clear_signals( api, signo, the_info, true, false, false );
- _POSIX_signals_Release( &lock_context );
+ _POSIX_signals_Release( &queue_context );
the_info->si_signo = signo;
the_info->si_code = SI_USER;
@@ -151,13 +152,14 @@ int sigtimedwait(
executing->Wait.option = *set;
executing->Wait.return_argument = the_info;
+ _Thread_queue_Context_set_expected_level( &queue_context, 1 );
_Thread_queue_Enqueue_critical(
&_POSIX_signals_Wait_queue.Queue,
POSIX_SIGNALS_TQ_OPERATIONS,
executing,
STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
interval,
- &lock_context
+ &queue_context
);
/*