Annotation of embedaddon/mpd/src/timer.h, revision 1.1.1.2
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:
1.1.1.2 ! misho 20: #define TICKSPERSEC 1000 /* Microsecond granularity */
! 21: #define SECONDS TICKSPERSEC /* Timers count in usec */
1.1 misho 22:
1.1.1.2 ! misho 23: struct pppTimer;
! 24: typedef struct pppTimer *PppTimer;
1.1 misho 25:
1.1.1.2 ! misho 26: struct pppTimer {
! 27: EventRef event; /* Event registration */
! 28: u_int load; /* Initial load value */
! 29: void (*func) (void *arg); /* Called when timer expires */
! 30: void *arg; /* Arg passed to timeout function */
! 31: const char *desc;
! 32: const char *dbg;
! 33: };
1.1 misho 34:
35: /*
36: * FUNCTIONS
37: */
38:
1.1.1.2 ! misho 39: #define TimerInit(timer, desc, load, handler, arg) \
1.1 misho 40: TimerInit2(timer, desc, load, handler, arg, #handler)
1.1.1.2 ! misho 41: extern void
! 42: TimerInit2(PppTimer timer, const char *desc,
! 43: int load, void (*handler) (void *), void *arg, const char *dbg);
! 44:
1.1 misho 45: #define TimerStart(t) \
46: TimerStart2(t, __FILE__, __LINE__)
1.1.1.2 ! misho 47: extern void TimerStart2(PppTimer t, const char *file, int line);
! 48:
1.1 misho 49: #define TimerStartRecurring(t) \
50: TimerStartRecurring2(t, __FILE__, __LINE__)
1.1.1.2 ! misho 51: extern void TimerStartRecurring2(PppTimer t, const char *file, int line);
! 52:
1.1 misho 53: #define TimerStop(t) \
54: TimerStop2(t, __FILE__, __LINE__)
1.1.1.2 ! misho 55: extern void TimerStop2(PppTimer t, const char *file, int line);
! 56: extern int TimerRemain(PppTimer t);
! 57: extern int TimerStarted(PppTimer t);
1.1 misho 58:
59: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>