source: rtems/cpukit/rtems/src/ratemoncancel.c @ 300f6a48

5
Last change on this file since 300f6a48 was 300f6a48, checked in by Sebastian Huber <sebastian.huber@…>, on 06/22/16 at 15:09:23

score: Rework thread priority management

Add priority nodes which contribute to the overall thread priority.

The actual priority of a thread is now an aggregation of priority nodes.
The thread priority aggregation for the home scheduler instance of a
thread consists of at least one priority node, which is normally the
real priority of the thread. The locking protocols (e.g. priority
ceiling and priority inheritance), rate-monotonic period objects and the
POSIX sporadic server add, change and remove priority nodes.

A thread changes its priority now immediately, e.g. priority changes are
not deferred until the thread releases its last resource.

Replace the _Thread_Change_priority() function with

  • _Thread_Priority_perform_actions(),
  • _Thread_Priority_add(),
  • _Thread_Priority_remove(),
  • _Thread_Priority_change(), and
  • _Thread_Priority_update().

Update #2412.
Update #2556.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Rate Monotonic Cancel
5 *  @ingroup ClassicRateMon
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright (c) 2016 embedded brains GmbH.
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/rtems/ratemonimpl.h>
23
24void _Rate_monotonic_Cancel(
25  Rate_monotonic_Control *the_period,
26  Thread_Control         *owner,
27  ISR_lock_Context       *lock_context
28)
29{
30  Per_CPU_Control      *cpu_self;
31  Thread_queue_Context  queue_context;
32
33  _Rate_monotonic_Acquire_critical( the_period, lock_context );
34
35  _Watchdog_Per_CPU_remove_relative( &the_period->Timer );
36  the_period->state = RATE_MONOTONIC_INACTIVE;
37  _Scheduler_Cancel_job(
38    the_period->owner,
39    &the_period->Priority,
40    &queue_context
41  );
42
43  cpu_self = _Thread_Dispatch_disable_critical( lock_context );
44  _Rate_monotonic_Release( the_period, lock_context );
45  _Thread_Priority_update( &queue_context );
46  _Thread_Dispatch_enable( cpu_self );
47}
48
49rtems_status_code rtems_rate_monotonic_cancel(
50  rtems_id id
51)
52{
53  Rate_monotonic_Control *the_period;
54  ISR_lock_Context        lock_context;
55  Thread_Control         *executing;
56
57  the_period = _Rate_monotonic_Get( id, &lock_context );
58  if ( the_period == NULL ) {
59    return RTEMS_INVALID_ID;
60  }
61
62  executing = _Thread_Executing;
63  if ( executing != the_period->owner ) {
64    _ISR_lock_ISR_enable( &lock_context );
65    return RTEMS_NOT_OWNER_OF_RESOURCE;
66  }
67
68  _Rate_monotonic_Cancel( the_period, executing, &lock_context );
69  return RTEMS_SUCCESSFUL;
70}
Note: See TracBrowser for help on using the repository browser.