source: rtems/cpukit/rtems/src/timerdelete.c @ 23fec9f0

4.115
Last change on this file since 23fec9f0 was 23fec9f0, checked in by Sebastian Huber <sebastian.huber@…>, on 03/27/14 at 13:16:12

score: PR2152: Use allocator mutex for objects

Use allocator mutex for objects allocate/free. This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Delete Timer
5 *  @ingroup ClassicTimer
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
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
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/score/thread.h>
25#include <rtems/rtems/timerimpl.h>
26#include <rtems/score/watchdogimpl.h>
27
28rtems_status_code rtems_timer_delete(
29  rtems_id id
30)
31{
32  Timer_Control     *the_timer;
33  Objects_Locations  location;
34
35  _Objects_Allocator_lock();
36  the_timer = _Timer_Get( id, &location );
37  switch ( location ) {
38
39    case OBJECTS_LOCAL:
40      _Objects_Close( &_Timer_Information, &the_timer->Object );
41      (void) _Watchdog_Remove( &the_timer->Ticker );
42      _Objects_Put( &the_timer->Object );
43      _Timer_Free( the_timer );
44      _Objects_Allocator_unlock();
45      return RTEMS_SUCCESSFUL;
46
47#if defined(RTEMS_MULTIPROCESSING)
48    case OBJECTS_REMOTE:            /* should never return this */
49#endif
50    case OBJECTS_ERROR:
51      break;
52  }
53
54  _Objects_Allocator_unlock();
55
56  return RTEMS_INVALID_ID;
57}
Note: See TracBrowser for help on using the repository browser.