source: rtems/cpukit/posix/src/timerinserthelper.c @ f8437c8

4.104.114.95
Last change on this file since f8437c8 was f8437c8, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 15:23:12

Convert to "bool".

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  Helper routine for POSIX timers
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
20#include <rtems/system.h>
21#include <rtems/seterr.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/watchdog.h>
24#include <rtems/posix/timer.h>
25#include <rtems/posix/ptimer.h>
26
27bool _POSIX_Timer_Insert_helper(
28  Watchdog_Control               *timer,
29  Watchdog_Interval               ticks,
30  Objects_Id                      id,
31  Watchdog_Service_routine_entry  TSR,
32  void                           *arg
33)
34{
35  ISR_Level            level;
36
37  (void) _Watchdog_Remove( timer );
38  _ISR_Disable( level );
39
40    /*
41     *  Check to see if the watchdog has just been inserted by a
42     *  higher priority interrupt.  If so, abandon this insert.
43     */
44    if ( timer->state != WATCHDOG_INACTIVE ) {
45      _ISR_Enable( level );
46      return false;
47    }
48
49    /*
50     *  OK.  Now we now the timer was not rescheduled by an interrupt
51     *  so we can atomically initialize it as in use.
52     */
53    _Watchdog_Initialize( timer, TSR, id, arg );
54    _Watchdog_Insert_ticks( timer, ticks );
55  _ISR_Enable( level );
56  return true;
57}
Note: See TracBrowser for help on using the repository browser.