diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-04 10:20:29 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-04 10:20:29 +0200 |
commit | ee0e41355d1faa5f74085effc4f57c3a7fc1f884 (patch) | |
tree | c845395523e084218ca6715977648b807d30605d /cpukit/score/include/rtems/score/schedulerimpl.h | |
parent | score: Fix _Thread_queue_Path_release() (diff) | |
download | rtems-ee0e41355d1faa5f74085effc4f57c3a7fc1f884.tar.bz2 |
score: Fix a release/cancel job race condition
Split up the potential thread priority change in the scheduler
release/cancel job operation. Protect the rate monotonic period state
with a dedicated SMP lock. This avoids a race condition during
_Rate_monotonic_Timeout() while _Rate_monotonic_Cancel() is called on
another processor.
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulerimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/schedulerimpl.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index 91fa178d20..1c5a697619 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -496,29 +496,37 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Node_destroy( * * @param[in] the_thread The thread. * @param[in] deadline The deadline in watchdog ticks since boot. + * + * @return The thread to hand over to _Thread_Update_priority(). */ -RTEMS_INLINE_ROUTINE void _Scheduler_Release_job( +RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Release_job( Thread_Control *the_thread, uint64_t deadline ) { const Scheduler_Control *scheduler = _Scheduler_Get( the_thread ); - ( *scheduler->Operations.release_job )( scheduler, the_thread, deadline ); + return ( *scheduler->Operations.release_job )( + scheduler, + the_thread, + deadline + ); } /** * @brief Cancels a job of a thread with respect to the scheduler. * * @param[in] the_thread The thread. + * + * @return The thread to hand over to _Thread_Update_priority(). */ -RTEMS_INLINE_ROUTINE void _Scheduler_Cancel_job( +RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Cancel_job( Thread_Control *the_thread ) { const Scheduler_Control *scheduler = _Scheduler_Get( the_thread ); - ( *scheduler->Operations.cancel_job )( scheduler, the_thread ); + return ( *scheduler->Operations.cancel_job )( scheduler, the_thread ); } /** |