summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadrestart.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/score/src/threadrestart.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/score/src/threadrestart.c')
-rw-r--r--cpukit/score/src/threadrestart.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 3bddac458d..f155980c1a 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -443,10 +443,10 @@ static void _Thread_Finalize_life_change(
}
void _Thread_Join(
- Thread_Control *the_thread,
- States_Control waiting_for_join,
- Thread_Control *executing,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ States_Control waiting_for_join,
+ Thread_Control *executing,
+ Thread_queue_Context *queue_context
)
{
_Assert( the_thread != executing );
@@ -462,7 +462,7 @@ void _Thread_Join(
executing,
waiting_for_join,
WATCHDOG_NO_TIMEOUT,
- lock_context
+ queue_context
);
}
@@ -524,14 +524,16 @@ void _Thread_Cancel(
void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing )
{
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
- _Thread_State_acquire( the_thread, &lock_context );
+ _Thread_queue_Context_initialize( &queue_context );
+ _Thread_queue_Context_set_expected_level( &queue_context, 2 );
+ _Thread_State_acquire( the_thread, &queue_context.Lock_context );
_Thread_Join(
the_thread,
STATES_WAITING_FOR_JOIN,
executing,
- &lock_context
+ &queue_context
);
_Thread_Cancel( the_thread, executing, NULL );
}