File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
mpd /
src /
timer.h
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Mon Jul 22 08:44:29 2013 UTC (11 years, 5 months ago) by
misho
Branches:
mpd,
MAIN
CVS tags:
v5_8p7,
v5_8p1_cross,
v5_8p1,
v5_8,
v5_7p0,
v5_7,
v5_6,
HEAD
5.7
/*
* timer.h
*
* Written by Archie Cobbs <archie@freebsd.org>
* Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
* See ``COPYRIGHT.whistle''
*/
#ifndef _TIMER_H_
#define _TIMER_H_
#include "defs.h"
#include "event.h"
/*
* DEFINITIONS
*/
#define TICKSPERSEC 1000 /* Microsecond granularity */
#define SECONDS TICKSPERSEC /* Timers count in usec */
struct pppTimer;
typedef struct pppTimer *PppTimer;
struct pppTimer
{
EventRef event; /* Event registration */
u_int load; /* Initial load value */
void (*func)(void *arg); /* Called when timer expires */
void *arg; /* Arg passed to timeout function */
const char *desc;
const char *dbg;
};
/*
* FUNCTIONS
*/
#define TimerInit(timer, desc, load, handler, arg) \
TimerInit2(timer, desc, load, handler, arg, #handler)
extern void TimerInit2(PppTimer timer, const char *desc,
int load, void (*handler)(void *), void *arg, const char *dbg);
#define TimerStart(t) \
TimerStart2(t, __FILE__, __LINE__)
extern void TimerStart2(PppTimer t, const char *file, int line);
#define TimerStartRecurring(t) \
TimerStartRecurring2(t, __FILE__, __LINE__)
extern void TimerStartRecurring2(PppTimer t, const char *file, int line);
#define TimerStop(t) \
TimerStop2(t, __FILE__, __LINE__)
extern void TimerStop2(PppTimer t, const char *file, int line);
extern int TimerRemain(PppTimer t);
extern int TimerStarted(PppTimer t);
#endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>