source: rtems/cpukit/posix/src/timerdelete.c @ be1b8a7

4.115
Last change on this file since be1b8a7 was 4b48ece0, checked in by Sebastian Huber <sebastian.huber@…>, on 07/22/13 at 08:21:03

score: Create watchdog implementation header

Move implementation specific parts of watchdog.h and watchdog.inl into
new header file watchdogimpl.h. The watchdog.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @brief Deletes a POSIX Interval Timer
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266
10 *
11 *  COPYRIGHT (c) 1989-2007.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <time.h>
24#include <errno.h>
25#include <pthread.h>
26
27#include <rtems/system.h>
28#include <rtems/seterr.h>
29#include <rtems/score/thread.h>
30#include <rtems/score/watchdogimpl.h>
31#include <rtems/posix/time.h>
32#include <rtems/posix/timerimpl.h>
33
34
35int timer_delete(
36  timer_t timerid
37)
38{
39 /*
40  * IDEA: This function must probably stop the timer first and then delete it
41  *
42  *       It will have to do a call to rtems_timer_cancel and then another
43  *       call to rtems_timer_delete.
44  *       The call to rtems_timer_delete will be probably unnecessary,
45  *       because rtems_timer_delete stops the timer before deleting it.
46  */
47  POSIX_Timer_Control *ptimer;
48  Objects_Locations    location;
49
50  ptimer = _POSIX_Timer_Get( timerid, &location );
51  switch ( location ) {
52
53    case OBJECTS_LOCAL:
54      _Objects_Close( &_POSIX_Timer_Information, &ptimer->Object );
55      ptimer->state = POSIX_TIMER_STATE_FREE;
56      (void) _Watchdog_Remove( &ptimer->Timer );
57      _POSIX_Timer_Free( ptimer );
58      _Objects_Put( &ptimer->Object );
59      return 0;
60
61#if defined(RTEMS_MULTIPROCESSING)
62    case OBJECTS_REMOTE:
63#endif
64    case OBJECTS_ERROR:
65      break;
66  }
67
68  rtems_set_errno_and_return_minus_one( EINVAL );
69}
Note: See TracBrowser for help on using the repository browser.