source: rtems/cpukit/rtems/src/ratemonresetstatistics.c @ 66cb142

5
Last change on this file since 66cb142 was ee0e4135, checked in by Sebastian Huber <sebastian.huber@…>, on 08/04/16 at 08:20:29

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.

  • Property mode set to 100644
File size: 932 bytes
Line 
1/**
2 * @file
3 *
4 * @brief RTEMS Rate Monotonic Reset Statistics
5 * @ingroup ClassicRateMon Rate Monotonic Scheduler
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/ratemonimpl.h>
22
23rtems_status_code rtems_rate_monotonic_reset_statistics(
24  rtems_id id
25)
26{
27  Rate_monotonic_Control *the_period;
28  ISR_lock_Context        lock_context;
29
30  the_period = _Rate_monotonic_Get( id, &lock_context );
31  if ( the_period == NULL ) {
32    return RTEMS_INVALID_ID;
33  }
34
35  _Rate_monotonic_Acquire_critical( the_period, &lock_context );
36  _Rate_monotonic_Reset_statistics( the_period );
37  _Rate_monotonic_Release( the_period, &lock_context );
38  return RTEMS_SUCCESSFUL;
39}
Note: See TracBrowser for help on using the repository browser.