diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-06 06:44:41 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-12 13:24:40 +0200 |
commit | 6e4f929296b1cfd50fc8f41f117459e65214b816 (patch) | |
tree | 9819ea160f6c745dae1936ae296709026d3d47a2 /cpukit/rtems | |
parent | score: Add _Thread_queue_Is_lock_owner() (diff) | |
download | rtems-6e4f929296b1cfd50fc8f41f117459e65214b816.tar.bz2 |
score: Introduce thread state lock
Update #2556.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/signalimpl.h | 8 | ||||
-rw-r--r-- | cpukit/rtems/src/signalcatch.c | 10 | ||||
-rw-r--r-- | cpukit/rtems/src/signalsend.c | 7 | ||||
-rw-r--r-- | cpukit/rtems/src/taskmode.c | 4 |
4 files changed, 17 insertions, 12 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/signalimpl.h b/cpukit/rtems/include/rtems/rtems/signalimpl.h index b19b2ace84..61848ae95c 100644 --- a/cpukit/rtems/include/rtems/rtems/signalimpl.h +++ b/cpukit/rtems/include/rtems/rtems/signalimpl.h @@ -18,7 +18,6 @@ #define _RTEMS_RTEMS_SIGNALIMPL_H #include <rtems/rtems/signal.h> -#include <rtems/score/percpu.h> #include <rtems/score/thread.h> #ifdef __cplusplus @@ -33,10 +32,9 @@ extern "C" { /**@{*/ void _Signal_Action_handler( - Thread_Control *thread, - Thread_Action *action, - Per_CPU_Control *cpu, - ISR_Level level + Thread_Control *executing, + Thread_Action *action, + ISR_lock_Context *lock_context ); /**@}*/ diff --git a/cpukit/rtems/src/signalcatch.c b/cpukit/rtems/src/signalcatch.c index 73138a1015..e300890f6a 100644 --- a/cpukit/rtems/src/signalcatch.c +++ b/cpukit/rtems/src/signalcatch.c @@ -22,13 +22,13 @@ #include <rtems/rtems/signalimpl.h> #include <rtems/rtems/asrimpl.h> #include <rtems/rtems/tasks.h> +#include <rtems/score/assert.h> #include <rtems/score/threadimpl.h> void _Signal_Action_handler( - Thread_Control *executing, - Thread_Action *action, - Per_CPU_Control *cpu, - ISR_Level level + Thread_Control *executing, + Thread_Action *action, + ISR_lock_Context *lock_context ) { RTEMS_API_Control *api; @@ -37,7 +37,7 @@ void _Signal_Action_handler( Modes_Control prev_mode; (void) action; - _Thread_Action_release_and_ISR_enable( cpu, level ); + _Thread_State_release( executing, lock_context ); api = executing->API_Extensions[ THREAD_API_RTEMS ]; if ( !api ) diff --git a/cpukit/rtems/src/signalsend.c b/cpukit/rtems/src/signalsend.c index 162de5c7c8..abf3d5d1a3 100644 --- a/cpukit/rtems/src/signalsend.c +++ b/cpukit/rtems/src/signalsend.c @@ -59,14 +59,19 @@ rtems_status_code rtems_signal_send( } if ( asr->is_enabled ) { + Per_CPU_Control *cpu_self; + _ASR_Post_signals( signal_set, &asr->signals_posted ); _ASR_Release( asr, &lock_context ); + _Thread_State_acquire( the_thread, &lock_context ); _Thread_Add_post_switch_action( the_thread, &api->Signal_action, _Signal_Action_handler ); - _Thread_Dispatch(); + cpu_self = _Thread_Dispatch_disable_critical( &lock_context ); + _Thread_State_release( the_thread, &lock_context ); + _Thread_Dispatch_enable( cpu_self ); } else { _ASR_Post_signals( signal_set, &asr->signals_pending ); _ASR_Release( asr, &lock_context ); diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c index e2dc7ed9d8..2f8f354b16 100644 --- a/cpukit/rtems/src/taskmode.c +++ b/cpukit/rtems/src/taskmode.c @@ -32,6 +32,7 @@ rtems_status_code rtems_task_mode( rtems_mode *previous_mode_set ) { + ISR_lock_Context lock_context; Thread_Control *executing; RTEMS_API_Control *api; ASR_Information *asr; @@ -102,18 +103,19 @@ rtems_status_code rtems_task_mode( if ( _ASR_Swap_signals( asr ) != 0 ) { needs_asr_dispatching = true; + _Thread_State_acquire( executing, &lock_context ); _Thread_Add_post_switch_action( executing, &api->Signal_action, _Signal_Action_handler ); + _Thread_State_release( executing, &lock_context ); } } } if ( preempt_enabled || needs_asr_dispatching ) { Per_CPU_Control *cpu_self; - ISR_lock_Context lock_context; cpu_self = _Thread_Dispatch_disable(); _Scheduler_Acquire( executing, &lock_context ); |