source: rtems/cpukit/rtems/src/ratemoncancel.c @ 5f9b3db

4.104.114.84.95
Last change on this file since 5f9b3db was 5f9b3db, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:03:07

Split Rate Monotonic Manager into one routine per file.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  Rate Monotonic Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/support.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/rtems/ratemon.h>
22#include <rtems/score/thread.h>
23
24/*PAGE
25 *
26 *  rtems_rate_monotonic_cancel
27 *
28 *  This directive allows a thread to cancel a rate monotonic timer.
29 *
30 *  Input parameters:
31 *    id - rate monotonic id
32 *
33 *  Output parameters:
34 *    RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
35 *    error code        - if unsuccessful
36 */
37
38rtems_status_code rtems_rate_monotonic_cancel(
39  Objects_Id id
40)
41{
42  Rate_monotonic_Control *the_period;
43  Objects_Locations              location;
44
45  the_period = _Rate_monotonic_Get( id, &location );
46  switch ( location ) {
47    case OBJECTS_REMOTE:           
48      return RTEMS_INTERNAL_ERROR;  /* should never return this */
49
50    case OBJECTS_ERROR:
51      return RTEMS_INVALID_ID;
52
53    case OBJECTS_LOCAL:
54      if ( !_Thread_Is_executing( the_period->owner ) ) {
55        _Thread_Enable_dispatch();
56        return RTEMS_NOT_OWNER_OF_RESOURCE;
57      }
58      (void) _Watchdog_Remove( &the_period->Timer );
59      the_period->state = RATE_MONOTONIC_INACTIVE;
60      _Thread_Enable_dispatch();
61      return RTEMS_SUCCESSFUL;
62  }
63
64  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
65}
Note: See TracBrowser for help on using the repository browser.