source: rtems/cpukit/posix/src/timerdelete.c @ 5cb175bb

4.115
Last change on this file since 5cb175bb was 5cb175bb, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/13 at 19:22:31

cpukit/posix: Doxygen group is POSIXAPI

  • 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/posix/time.h>
31#include <rtems/posix/timer.h>
32
33
34int timer_delete(
35  timer_t timerid
36)
37{
38 /*
39  * IDEA: This function must probably stop the timer first and then delete it
40  *
41  *       It will have to do a call to rtems_timer_cancel and then another
42  *       call to rtems_timer_delete.
43  *       The call to rtems_timer_delete will be probably unnecessary,
44  *       because rtems_timer_delete stops the timer before deleting it.
45  */
46  POSIX_Timer_Control *ptimer;
47  Objects_Locations    location;
48
49  ptimer = _POSIX_Timer_Get( timerid, &location );
50  switch ( location ) {
51
52    case OBJECTS_LOCAL:
53      _Objects_Close( &_POSIX_Timer_Information, &ptimer->Object );
54      ptimer->state = POSIX_TIMER_STATE_FREE;
55      (void) _Watchdog_Remove( &ptimer->Timer );
56      _POSIX_Timer_Free( ptimer );
57      _Thread_Enable_dispatch();
58      return 0;
59
60#if defined(RTEMS_MULTIPROCESSING)
61    case OBJECTS_REMOTE:
62#endif
63    case OBJECTS_ERROR:
64      break;
65  }
66
67  rtems_set_errno_and_return_minus_one( EINVAL );
68}
Note: See TracBrowser for help on using the repository browser.