source: rtems/c/src/exec/rtems/src/timerdelete.c @ be47df9

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

Split Timer Manager into one routine per file.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Timer 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/object.h>
20#include <rtems/score/thread.h>
21#include <rtems/rtems/timer.h>
22#include <rtems/score/tod.h>
23#include <rtems/score/watchdog.h>
24
25/*PAGE
26 *
27 *  rtems_timer_delete
28 *
29 *  This directive allows a thread to delete a timer.
30 *
31 *  Input parameters:
32 *    id - timer id
33 *
34 *  Output parameters:
35 *    RTEMS_SUCCESSFUL - if successful
36 *    error code - if unsuccessful
37 */
38
39rtems_status_code rtems_timer_delete(
40  Objects_Id id
41)
42{
43  Timer_Control   *the_timer;
44  Objects_Locations       location;
45
46  the_timer = _Timer_Get( id, &location );
47  switch ( location ) {
48    case OBJECTS_REMOTE:            /* should never return this */
49      return RTEMS_INTERNAL_ERROR;
50
51    case OBJECTS_ERROR:
52      return RTEMS_INVALID_ID;
53
54    case OBJECTS_LOCAL:
55      _Objects_Close( &_Timer_Information, &the_timer->Object );
56      (void) _Watchdog_Remove( &the_timer->Ticker );
57      _Timer_Free( the_timer );
58      _Thread_Enable_dispatch();
59      return RTEMS_SUCCESSFUL;
60  }
61
62  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
63}
Note: See TracBrowser for help on using the repository browser.