source: rtems/cpukit/score/src/schedulercbsreleasejob.c @ ee0e4135

5
Last change on this file since ee0e4135 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: 987 bytes
Line 
1/**
2 * @file
3 *
4 * @brief Scheduler CBS Release Job
5 *
6 * @ingroup ScoreScheduler
7 */
8
9/*
10 *  Copyright (C) 2011 Petr Benes.
11 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/score/schedulercbsimpl.h>
23
24Thread_Control *_Scheduler_CBS_Release_job(
25  const Scheduler_Control *scheduler,
26  Thread_Control          *the_thread,
27  uint64_t                 deadline
28)
29{
30  Scheduler_CBS_Node   *node;
31  Scheduler_CBS_Server *serv_info;
32
33  node = _Scheduler_CBS_Thread_get_node( the_thread );
34  serv_info = node->cbs_server;
35
36  /* Budget replenishment for the next job. */
37  if ( serv_info != NULL ) {
38    the_thread->cpu_time_budget = serv_info->parameters.budget;
39  }
40
41  return _Scheduler_EDF_Release_job( scheduler, the_thread, deadline );
42}
Note: See TracBrowser for help on using the repository browser.