RTEMS
timercancel.c
1 /*
2  * Timer Manager - rtems_timer_cancel directive
3  *
4  *
5  * COPYRIGHT (c) 1989-2007.
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.rtems.org/license/LICENSE.
11  */
12 
13 #ifdef HAVE_CONFIG_H
14 #include "config.h"
15 #endif
16 
17 #include <rtems/rtems/timerimpl.h>
18 
20  rtems_id id
21 )
22 {
23  Timer_Control *the_timer;
24  ISR_lock_Context lock_context;
25 
26  the_timer = _Timer_Get( id, &lock_context );
27  if ( the_timer != NULL ) {
28  Per_CPU_Control *cpu;
29 
30  cpu = _Timer_Acquire_critical( the_timer, &lock_context );
31  _Timer_Cancel( cpu, the_timer );
32  _Timer_Release( cpu, &lock_context );
33  return RTEMS_SUCCESSFUL;
34  }
35 
36  return RTEMS_INVALID_ID;
37 }
Classic Timer Implementation.
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Per CPU Core Structure.
Definition: percpu.h:347
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
rtems_status_code rtems_timer_cancel(rtems_id id)
%
Definition: timercancel.c:19
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65