source: rtems/cpukit/posix/src/timerdelete.c @ 92f4671

4.104.115
Last change on this file since 92f4671 was a6cbc9b, checked in by Joel Sherrill <joel.sherrill@…>, on 12/17/07 at 16:01:42

2007-12-17 Joel Sherrill <joel.sherrill@…>

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