source: rtems/c/src/exec/rtems/src/ratemoncancel.c @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

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