version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.2, 2021/03/17 00:39:23
|
Line 17
|
Line 17
|
* DEFINITIONS |
* DEFINITIONS |
*/ |
*/ |
|
|
#define TICKSPERSEC 1000 /* Microsecond granularity */ | #define TICKSPERSEC 1000 /* Microsecond granularity */ |
#define SECONDS TICKSPERSEC /* Timers count in usec */ | #define SECONDS TICKSPERSEC /* Timers count in usec */ |
|
|
struct pppTimer; | struct pppTimer; |
typedef struct pppTimer *PppTimer; | typedef struct pppTimer *PppTimer; |
|
|
struct pppTimer | struct pppTimer { |
{ | EventRef event; /* Event registration */ |
EventRef event; /* Event registration */ | u_int load; /* Initial load value */ |
u_int load; /* Initial load value */ | void (*func) (void *arg); /* Called when timer expires */ |
void (*func)(void *arg); /* Called when timer expires */ | void *arg; /* Arg passed to timeout function */ |
void *arg; /* Arg passed to timeout function */ | const char *desc; |
const char *desc; | const char *dbg; |
const char *dbg; | }; |
}; | |
|
|
/* |
/* |
* FUNCTIONS |
* FUNCTIONS |
*/ |
*/ |
|
|
#define TimerInit(timer, desc, load, handler, arg) \ | #define TimerInit(timer, desc, load, handler, arg) \ |
TimerInit2(timer, desc, load, handler, arg, #handler) |
TimerInit2(timer, desc, load, handler, arg, #handler) |
extern void TimerInit2(PppTimer timer, const char *desc, | extern void |
int load, void (*handler)(void *), void *arg, const char *dbg); | TimerInit2(PppTimer timer, const char *desc, |
| int load, void (*handler) (void *), void *arg, const char *dbg); |
| |
#define TimerStart(t) \ |
#define TimerStart(t) \ |
TimerStart2(t, __FILE__, __LINE__) |
TimerStart2(t, __FILE__, __LINE__) |
extern void TimerStart2(PppTimer t, const char *file, int line); | extern void TimerStart2(PppTimer t, const char *file, int line); |
| |
#define TimerStartRecurring(t) \ |
#define TimerStartRecurring(t) \ |
TimerStartRecurring2(t, __FILE__, __LINE__) |
TimerStartRecurring2(t, __FILE__, __LINE__) |
extern void TimerStartRecurring2(PppTimer t, const char *file, int line); | extern void TimerStartRecurring2(PppTimer t, const char *file, int line); |
| |
#define TimerStop(t) \ |
#define TimerStop(t) \ |
TimerStop2(t, __FILE__, __LINE__) |
TimerStop2(t, __FILE__, __LINE__) |
extern void TimerStop2(PppTimer t, const char *file, int line); | extern void TimerStop2(PppTimer t, const char *file, int line); |
extern int TimerRemain(PppTimer t); | extern int TimerRemain(PppTimer t); |
extern int TimerStarted(PppTimer t); | extern int TimerStarted(PppTimer t); |
|
|
#endif |
#endif |
|
|