Annotation of embedaddon/mpd/src/timer.h, revision 1.1.1.1

1.1       misho       1: 
                      2: /*
                      3:  * timer.h
                      4:  *
                      5:  * Written by Archie Cobbs <archie@freebsd.org>
                      6:  * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
                      7:  * See ``COPYRIGHT.whistle''
                      8:  */
                      9: 
                     10: #ifndef _TIMER_H_
                     11: #define        _TIMER_H_
                     12: 
                     13: #include "defs.h"
                     14: #include "event.h"
                     15: 
                     16: /*
                     17:  * DEFINITIONS
                     18:  */
                     19: 
                     20:   #define TICKSPERSEC  1000            /* Microsecond granularity */
                     21:   #define SECONDS      TICKSPERSEC     /* Timers count in usec */
                     22: 
                     23:   struct pppTimer;
                     24:   typedef struct pppTimer *PppTimer;
                     25: 
                     26:   struct pppTimer
                     27:   {
                     28:     EventRef   event;                  /* Event registration */
                     29:     u_int      load;                   /* Initial load value */
                     30:     void       (*func)(void *arg);     /* Called when timer expires */
                     31:     void       *arg;                   /* Arg passed to timeout function */
                     32:     const char *desc;
                     33:     const char *dbg;
                     34:   };
                     35: 
                     36: /*
                     37:  * FUNCTIONS
                     38:  */
                     39: 
                     40: #define        TimerInit(timer, desc, load, handler, arg)                              \
                     41:            TimerInit2(timer, desc, load, handler, arg, #handler)
                     42:   extern void  TimerInit2(PppTimer timer, const char *desc,
                     43:                  int load, void (*handler)(void *), void *arg, const char *dbg);
                     44: #define        TimerStart(t)   \
                     45:            TimerStart2(t, __FILE__, __LINE__)
                     46:   extern void  TimerStart2(PppTimer t, const char *file, int line);
                     47: #define        TimerStartRecurring(t)  \
                     48:            TimerStartRecurring2(t, __FILE__, __LINE__)
                     49:   extern void  TimerStartRecurring2(PppTimer t, const char *file, int line);
                     50: #define        TimerStop(t)    \
                     51:            TimerStop2(t, __FILE__, __LINE__)
                     52:   extern void  TimerStop2(PppTimer t, const char *file, int line);
                     53:   extern int   TimerRemain(PppTimer t);
                     54:   extern int   TimerStarted(PppTimer t);
                     55: 
                     56: #endif
                     57: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>