summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/ratemongetstatus.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-04 10:20:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-04 10:20:29 +0200
commitee0e41355d1faa5f74085effc4f57c3a7fc1f884 (patch)
treec845395523e084218ca6715977648b807d30605d /cpukit/rtems/src/ratemongetstatus.c
parentscore: Fix _Thread_queue_Path_release() (diff)
downloadrtems-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/rtems/src/ratemongetstatus.c')
-rw-r--r--cpukit/rtems/src/ratemongetstatus.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c
index 82a950ec6a..403c6ed097 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -28,7 +28,6 @@ rtems_status_code rtems_rate_monotonic_get_status(
{
Rate_monotonic_Control *the_period;
ISR_lock_Context lock_context;
- Thread_Control *owner;
rtems_status_code status;
if ( period_status == NULL ) {
@@ -40,10 +39,9 @@ rtems_status_code rtems_rate_monotonic_get_status(
return RTEMS_INVALID_ID;
}
- owner = the_period->owner;
- _Rate_monotonic_Acquire_critical( owner, &lock_context );
+ _Rate_monotonic_Acquire_critical( the_period, &lock_context );
- period_status->owner = owner->Object.id;
+ period_status->owner = the_period->owner->Object.id;
period_status->state = the_period->state;
if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
@@ -81,6 +79,6 @@ rtems_status_code rtems_rate_monotonic_get_status(
}
}
- _Rate_monotonic_Release( owner, &lock_context );
+ _Rate_monotonic_Release( the_period, &lock_context );
return status;
}