summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/ratemonresetstatistics.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/ratemonresetstatistics.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/ratemonresetstatistics.c')
-rw-r--r--cpukit/rtems/src/ratemonresetstatistics.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/cpukit/rtems/src/ratemonresetstatistics.c b/cpukit/rtems/src/ratemonresetstatistics.c
index b146e6acb2..0b0e6c6369 100644
--- a/cpukit/rtems/src/ratemonresetstatistics.c
+++ b/cpukit/rtems/src/ratemonresetstatistics.c
@@ -26,16 +26,14 @@ rtems_status_code rtems_rate_monotonic_reset_statistics(
{
Rate_monotonic_Control *the_period;
ISR_lock_Context lock_context;
- Thread_Control *owner;
the_period = _Rate_monotonic_Get( id, &lock_context );
if ( the_period == NULL ) {
return RTEMS_INVALID_ID;
}
- owner = the_period->owner;
- _Rate_monotonic_Acquire_critical( owner, &lock_context );
+ _Rate_monotonic_Acquire_critical( the_period, &lock_context );
_Rate_monotonic_Reset_statistics( the_period );
- _Rate_monotonic_Release( owner, &lock_context );
+ _Rate_monotonic_Release( the_period, &lock_context );
return RTEMS_SUCCESSFUL;
}