source: rtems/cpukit/rtems/src/timerdelete.c @ 66cb142

5
Last change on this file since 66cb142 was 77e6eba7, checked in by Sebastian Huber <sebastian.huber@…>, on 03/07/16 at 15:01:57

score: Add and use _Objects_Get_local()

This simplifies the handling with local-only objects.

Update #2555.

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[a6500136]1/**
2 *  @file
[be47df9]3 *
[a6500136]4 *  @brief RTEMS Delete Timer
5 *  @ingroup ClassicTimer
6 */
7
8/*
[0e87deaa]9 *  COPYRIGHT (c) 1989-2007.
[be47df9]10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
[c499856]14 *  http://www.rtems.org/license/LICENSE.
[be47df9]15 */
16
[1095ec1]17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
[e90b1df]21#include <rtems/rtems/timerimpl.h>
[be47df9]22
23rtems_status_code rtems_timer_delete(
[d3b72ca3]24  rtems_id id
[be47df9]25)
26{
[77e6eba7]27  Timer_Control    *the_timer;
28  ISR_lock_Context  lock_context;
[be47df9]29
[23fec9f0]30  _Objects_Allocator_lock();
[77e6eba7]31
32  the_timer = _Timer_Get( id, &lock_context );
33  if ( the_timer != NULL ) {
34    Per_CPU_Control *cpu;
35
36    _Objects_Close( &_Timer_Information, &the_timer->Object );
37    cpu = _Timer_Acquire_critical( the_timer, &lock_context );
38    _Timer_Cancel( cpu, the_timer );
39    _Timer_Release( cpu, &lock_context );
40    _Timer_Free( the_timer );
41    _Objects_Allocator_unlock();
42    return RTEMS_SUCCESSFUL;
[be47df9]43  }
44
[23fec9f0]45  _Objects_Allocator_unlock();
[ebe61382]46  return RTEMS_INVALID_ID;
[be47df9]47}
Note: See TracBrowser for help on using the repository browser.