You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2011/11/15 01:47:01 UTC
svn commit: r1201984 [3/3] - in
/trafficserver/traffic/trunk/tools/http_load: http_load.c port.h timers.c
timers.h
Modified: trafficserver/traffic/trunk/tools/http_load/port.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/tools/http_load/port.h?rev=1201984&r1=1201983&r2=1201984&view=diff
==============================================================================
--- trafficserver/traffic/trunk/tools/http_load/port.h (original)
+++ trafficserver/traffic/trunk/tools/http_load/port.h Tue Nov 15 00:47:01 2011
@@ -1,107 +1,107 @@
/* port.h - portability defines */
#if defined(__FreeBSD__)
-# define OS_FreeBSD
-# define ARCH "FreeBSD"
+#define OS_FreeBSD
+#define ARCH "FreeBSD"
#elif defined(__OpenBSD__)
-# define OS_OpenBSD
-# define ARCH "OpenBSD"
+#define OS_OpenBSD
+#define ARCH "OpenBSD"
#elif defined(__NetBSD__)
-# define OS_NetBSD
-# define ARCH "NetBSD"
+#define OS_NetBSD
+#define ARCH "NetBSD"
#elif defined(linux)
-# define OS_Linux
-# define ARCH "Linux"
+#define OS_Linux
+#define ARCH "Linux"
#elif defined(sun)
-# define OS_Solaris
-# define ARCH "Solaris"
+#define OS_Solaris
+#define ARCH "Solaris"
#elif defined(__osf__)
-# define OS_DigitalUnix
-# define ARCH "DigitalUnix"
+#define OS_DigitalUnix
+#define ARCH "DigitalUnix"
#elif defined(__svr4__)
-# define OS_SysV
-# define ARCH "SysV"
+#define OS_SysV
+#define ARCH "SysV"
#else
-# define OS_UNKNOWN
-# define ARCH "UNKNOWN"
+#define OS_UNKNOWN
+#define ARCH "UNKNOWN"
#endif
#ifdef OS_FreeBSD
-# include <osreldate.h>
-# define HAVE_DAEMON
-# define HAVE_SETSID
-# define HAVE_SETLOGIN
-# define HAVE_WAITPID
-# define HAVE_HSTRERROR
-# define HAVE_TM_GMTOFF
-# define HAVE_SENDFILE
-# define HAVE_SCANDIR
-# define HAVE_INT64T
-# define HAVE_SRANDOMDEV
-# ifdef SO_ACCEPTFILTER
-# define HAVE_ACCEPT_FILTERS
-# if ( __FreeBSD_version >= 411000 )
-# define ACCEPT_FILTER_NAME "httpready"
-# else
-# define ACCEPT_FILTER_NAME "dataready"
-# endif
-# endif /* SO_ACCEPTFILTER */
+#include <osreldate.h>
+#define HAVE_DAEMON
+#define HAVE_SETSID
+#define HAVE_SETLOGIN
+#define HAVE_WAITPID
+#define HAVE_HSTRERROR
+#define HAVE_TM_GMTOFF
+#define HAVE_SENDFILE
+#define HAVE_SCANDIR
+#define HAVE_INT64T
+#define HAVE_SRANDOMDEV
+#ifdef SO_ACCEPTFILTER
+#define HAVE_ACCEPT_FILTERS
+#if ( __FreeBSD_version >= 411000 )
+#define ACCEPT_FILTER_NAME "httpready"
+#else
+#define ACCEPT_FILTER_NAME "dataready"
+#endif
+#endif /* SO_ACCEPTFILTER */
#endif /* OS_FreeBSD */
#ifdef OS_OpenBSD
-# define HAVE_DAEMON
-# define HAVE_SETSID
-# define HAVE_SETLOGIN
-# define HAVE_WAITPID
-# define HAVE_HSTRERROR
-# define HAVE_TM_GMTOFF
-# define HAVE_SCANDIR
-# define HAVE_INT64T
+#define HAVE_DAEMON
+#define HAVE_SETSID
+#define HAVE_SETLOGIN
+#define HAVE_WAITPID
+#define HAVE_HSTRERROR
+#define HAVE_TM_GMTOFF
+#define HAVE_SCANDIR
+#define HAVE_INT64T
#endif /* OS_OpenBSD */
#ifdef OS_NetBSD
-# define HAVE_DAEMON
-# define HAVE_SETSID
-# define HAVE_SETLOGIN
-# define HAVE_WAITPID
-# define HAVE_HSTRERROR
-# define HAVE_TM_GMTOFF
-# define HAVE_SCANDIR
-# define HAVE_INT64T
+#define HAVE_DAEMON
+#define HAVE_SETSID
+#define HAVE_SETLOGIN
+#define HAVE_WAITPID
+#define HAVE_HSTRERROR
+#define HAVE_TM_GMTOFF
+#define HAVE_SCANDIR
+#define HAVE_INT64T
#endif /* OS_NetBSD */
#ifdef OS_Linux
-# define HAVE_DAEMON
-# define HAVE_SETSID
-# define HAVE_WAITPID
-# define HAVE_TM_GMTOFF
-# define HAVE_SENDFILE
-# define HAVE_LINUX_SENDFILE
-# define HAVE_SCANDIR
-# define HAVE_INT64T
+#define HAVE_DAEMON
+#define HAVE_SETSID
+#define HAVE_WAITPID
+#define HAVE_TM_GMTOFF
+#define HAVE_SENDFILE
+#define HAVE_LINUX_SENDFILE
+#define HAVE_SCANDIR
+#define HAVE_INT64T
#endif /* OS_Linux */
#ifdef OS_Solaris
-# define HAVE_SETSID
-# define HAVE_WAITPID
-# define HAVE_MEMORY_H
-# define HAVE_SIGSET
-# define HAVE_INT64T
+#define HAVE_SETSID
+#define HAVE_WAITPID
+#define HAVE_MEMORY_H
+#define HAVE_SIGSET
+#define HAVE_INT64T
#endif /* OS_Solaris */
#ifdef OS_DigitalUnix
-# define HAVE_SETSID
-# define HAVE_SETLOGIN
-# define HAVE_WAITPID
-# define HAVE_SCANDIR
-# define HAVE_TM_GMTOFF
-# define NO_SNPRINTF
-/* # define HAVE_INT64T */ /* Digital Unix 4.0d doesn't have int64_t */
+#define HAVE_SETSID
+#define HAVE_SETLOGIN
+#define HAVE_WAITPID
+#define HAVE_SCANDIR
+#define HAVE_TM_GMTOFF
+#define NO_SNPRINTF
+ /* # define HAVE_INT64T *//* Digital Unix 4.0d doesn't have int64_t */
#endif /* OS_DigitalUnix */
#ifdef OS_SysV
-# define HAVE_SETSID
-# define HAVE_WAITPID
-# define HAVE_MEMORY_H
-# define HAVE_SIGSET
+#define HAVE_SETSID
+#define HAVE_WAITPID
+#define HAVE_MEMORY_H
+#define HAVE_SIGSET
#endif /* OS_Solaris */
Modified: trafficserver/traffic/trunk/tools/http_load/timers.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/tools/http_load/timers.c?rev=1201984&r1=1201983&r2=1201984&view=diff
==============================================================================
--- trafficserver/traffic/trunk/tools/http_load/timers.c (original)
+++ trafficserver/traffic/trunk/tools/http_load/timers.c Tue Nov 15 00:47:01 2011
@@ -34,8 +34,8 @@
#define HASH_SIZE 67
-static Timer* timers[HASH_SIZE];
-static Timer* free_timers = (Timer*) 0;
+static Timer *timers[HASH_SIZE];
+static Timer *free_timers = (Timer *) 0;
static long mstimeout_cache = -1;
ClientData JunkClientData;
@@ -43,308 +43,271 @@ ClientData JunkClientData;
static unsigned int
-hash( Timer* t )
- {
- /* We can hash on the trigger time, even though it can change over
- ** the life of a timer via either the periodic bit or the tmr_reset()
- ** call. This is because both of those guys call l_resort(), which
- ** recomputes the hash and moves the timer to the appropriate list.
- */
- return (
- (unsigned int) t->time.tv_sec ^
- (unsigned int) t->time.tv_usec ) % HASH_SIZE;
- }
+hash(Timer * t)
+{
+ /* We can hash on the trigger time, even though it can change over
+ ** the life of a timer via either the periodic bit or the tmr_reset()
+ ** call. This is because both of those guys call l_resort(), which
+ ** recomputes the hash and moves the timer to the appropriate list.
+ */
+ return ((unsigned int) t->time.tv_sec ^ (unsigned int) t->time.tv_usec) % HASH_SIZE;
+}
static void
-l_add( Timer* t )
- {
- int h = t->hash;
- register Timer* t2;
- register Timer* t2prev;
-
- t2 = timers[h];
- if ( t2 == (Timer*) 0 )
- {
- /* The list is empty. */
- timers[h] = t;
- t->prev = t->next = (Timer*) 0;
- }
- else
- {
- if ( t->time.tv_sec < t2->time.tv_sec ||
- ( t->time.tv_sec == t2->time.tv_sec &&
- t->time.tv_usec <= t2->time.tv_usec ) )
- {
- /* The new timer goes at the head of the list. */
- timers[h] = t;
- t->prev = (Timer*) 0;
- t->next = t2;
- t2->prev = t;
- }
- else
- {
- /* Walk the list to find the insertion point. */
- for ( t2prev = t2, t2 = t2->next; t2 != (Timer*) 0;
- t2prev = t2, t2 = t2->next )
- {
- if ( t->time.tv_sec < t2->time.tv_sec ||
- ( t->time.tv_sec == t2->time.tv_sec &&
- t->time.tv_usec <= t2->time.tv_usec ) )
- {
- /* Found it. */
- t2prev->next = t;
- t->prev = t2prev;
- t->next = t2;
- t2->prev = t;
- return;
- }
- }
- /* Oops, got to the end of the list. Add to tail. */
- t2prev->next = t;
- t->prev = t2prev;
- t->next = (Timer*) 0;
- }
- }
+l_add(Timer * t)
+{
+ int h = t->hash;
+ register Timer *t2;
+ register Timer *t2prev;
+
+ t2 = timers[h];
+ if (t2 == (Timer *) 0) {
+ /* The list is empty. */
+ timers[h] = t;
+ t->prev = t->next = (Timer *) 0;
+ } else {
+ if (t->time.tv_sec < t2->time.tv_sec || (t->time.tv_sec == t2->time.tv_sec && t->time.tv_usec <= t2->time.tv_usec)) {
+ /* The new timer goes at the head of the list. */
+ timers[h] = t;
+ t->prev = (Timer *) 0;
+ t->next = t2;
+ t2->prev = t;
+ } else {
+ /* Walk the list to find the insertion point. */
+ for (t2prev = t2, t2 = t2->next; t2 != (Timer *) 0; t2prev = t2, t2 = t2->next) {
+ if (t->time.tv_sec < t2->time.tv_sec ||
+ (t->time.tv_sec == t2->time.tv_sec && t->time.tv_usec <= t2->time.tv_usec)) {
+ /* Found it. */
+ t2prev->next = t;
+ t->prev = t2prev;
+ t->next = t2;
+ t2->prev = t;
+ return;
+ }
+ }
+ /* Oops, got to the end of the list. Add to tail. */
+ t2prev->next = t;
+ t->prev = t2prev;
+ t->next = (Timer *) 0;
}
+ }
+}
static void
-l_remove( Timer* t )
- {
- int h = t->hash;
-
- if ( t->prev == (Timer*) 0 )
- timers[h] = t->next;
- else
- t->prev->next = t->next;
- if ( t->next != (Timer*) 0 )
- t->next->prev = t->prev;
- }
+l_remove(Timer * t)
+{
+ int h = t->hash;
+
+ if (t->prev == (Timer *) 0)
+ timers[h] = t->next;
+ else
+ t->prev->next = t->next;
+ if (t->next != (Timer *) 0)
+ t->next->prev = t->prev;
+}
static void
-l_resort( Timer* t )
- {
- /* Remove the timer from its old list. */
- l_remove( t );
- /* Recompute the hash. */
- t->hash = hash( t );
- /* And add it back in to its new list, sorted correctly. */
- l_add( t );
- }
+l_resort(Timer * t)
+{
+ /* Remove the timer from its old list. */
+ l_remove(t);
+ /* Recompute the hash. */
+ t->hash = hash(t);
+ /* And add it back in to its new list, sorted correctly. */
+ l_add(t);
+}
void
-tmr_init( void )
- {
- int h;
-
- mstimeout_cache = -1;
- for ( h = 0; h < HASH_SIZE; ++h )
- timers[h] = (Timer*) 0;
- }
+tmr_init(void)
+{
+ int h;
+
+ mstimeout_cache = -1;
+ for (h = 0; h < HASH_SIZE; ++h)
+ timers[h] = (Timer *) 0;
+}
-Timer*
-tmr_create(
- struct timeval* nowP, TimerProc* timer_proc, ClientData client_data,
- long msecs, int periodic )
- {
- Timer* t;
-
- if ( free_timers != (Timer*) 0 )
- {
- t = free_timers;
- free_timers = t->next;
- }
- else
- {
- t = (Timer*) malloc( sizeof(Timer) );
- if ( t == (Timer*) 0 )
- return (Timer*) 0;
- }
-
- mstimeout_cache = -1;
- t->timer_proc = timer_proc;
- t->client_data = client_data;
- t->msecs = msecs;
- t->periodic = periodic;
- if ( nowP != (struct timeval*) 0 )
- t->time = *nowP;
- else
- (void) gettimeofday( &t->time, (struct timezone*) 0 );
- t->time.tv_sec += msecs / 1000L;
- t->time.tv_usec += ( msecs % 1000L ) * 1000L;
- if ( t->time.tv_usec >= 1000000L )
- {
- t->time.tv_sec += t->time.tv_usec / 1000000L;
- t->time.tv_usec %= 1000000L;
- }
- t->hash = hash( t );
- /* Add the new timer to the proper active list. */
- l_add( t );
+Timer *
+tmr_create(struct timeval *nowP, TimerProc * timer_proc, ClientData client_data, long msecs, int periodic)
+{
+ Timer *t;
+
+ if (free_timers != (Timer *) 0) {
+ t = free_timers;
+ free_timers = t->next;
+ } else {
+ t = (Timer *) malloc(sizeof(Timer));
+ if (t == (Timer *) 0)
+ return (Timer *) 0;
+ }
+
+ mstimeout_cache = -1;
+ t->timer_proc = timer_proc;
+ t->client_data = client_data;
+ t->msecs = msecs;
+ t->periodic = periodic;
+ if (nowP != (struct timeval *) 0)
+ t->time = *nowP;
+ else
+ (void) gettimeofday(&t->time, (struct timezone *) 0);
+ t->time.tv_sec += msecs / 1000L;
+ t->time.tv_usec += (msecs % 1000L) * 1000L;
+ if (t->time.tv_usec >= 1000000L) {
+ t->time.tv_sec += t->time.tv_usec / 1000000L;
+ t->time.tv_usec %= 1000000L;
+ }
+ t->hash = hash(t);
+ /* Add the new timer to the proper active list. */
+ l_add(t);
- return t;
- }
+ return t;
+}
-struct timeval*
-tmr_timeout( struct timeval* nowP )
- {
- long msecs;
- static struct timeval timeout;
-
- msecs = tmr_mstimeout( nowP );
- if ( msecs == INFTIM )
- return (struct timeval*) 0;
- timeout.tv_sec = msecs / 1000L;
- timeout.tv_usec = ( msecs % 1000L ) * 1000L;
- return &timeout;
- }
+struct timeval *
+tmr_timeout(struct timeval *nowP)
+{
+ long msecs;
+ static struct timeval timeout;
+
+ msecs = tmr_mstimeout(nowP);
+ if (msecs == INFTIM)
+ return (struct timeval *) 0;
+ timeout.tv_sec = msecs / 1000L;
+ timeout.tv_usec = (msecs % 1000L) * 1000L;
+ return &timeout;
+}
long
-tmr_mstimeout( struct timeval* nowP )
- {
- if ( mstimeout_cache > -1 )
- {
- return mstimeout_cache;
- }
- else
- {
- int h;
- int gotone;
- long msecs, m;
- register Timer* t;
-
- gotone = 0;
- msecs = 0; /* make lint happy */
- /* Since the lists are sorted, we only need to look at the
- ** first timer on each one.
- */
- for ( h = 0; h < HASH_SIZE; ++h )
- {
- t = timers[h];
- if ( t != (Timer*) 0 )
- {
- m = ( t->time.tv_sec - nowP->tv_sec ) * 1000L +
- ( t->time.tv_usec - nowP->tv_usec ) / 1000L;
- if ( ! gotone )
- {
- msecs = m;
- gotone = 1;
- }
- else if ( m < msecs )
- msecs = m;
- }
- }
- if ( ! gotone )
- return INFTIM;
- if ( msecs <= 0 )
- msecs = 0;
- mstimeout_cache = msecs;
+tmr_mstimeout(struct timeval *nowP)
+{
+ if (mstimeout_cache > -1) {
+ return mstimeout_cache;
+ } else {
+ int h;
+ int gotone;
+ long msecs, m;
+ register Timer *t;
+
+ gotone = 0;
+ msecs = 0; /* make lint happy */
+ /* Since the lists are sorted, we only need to look at the
+ ** first timer on each one.
+ */
+ for (h = 0; h < HASH_SIZE; ++h) {
+ t = timers[h];
+ if (t != (Timer *) 0) {
+ m = (t->time.tv_sec - nowP->tv_sec) * 1000L + (t->time.tv_usec - nowP->tv_usec) / 1000L;
+ if (!gotone) {
+ msecs = m;
+ gotone = 1;
+ } else if (m < msecs)
+ msecs = m;
+ }
+ }
+ if (!gotone)
+ return INFTIM;
+ if (msecs <= 0)
+ msecs = 0;
+ mstimeout_cache = msecs;
- return msecs;
- }
- }
+ return msecs;
+ }
+}
void
-tmr_run( struct timeval* nowP )
- {
- int h;
- Timer* t;
- Timer* next;
-
- for ( h = 0; h < HASH_SIZE; ++h )
- for ( t = timers[h]; t != (Timer*) 0; t = next )
- {
- next = t->next;
- /* Since the lists are sorted, as soon as we find a timer
- ** that isn't ready yet, we can go on to the next list.
- */
- if ( t->time.tv_sec > nowP->tv_sec ||
- ( t->time.tv_sec == nowP->tv_sec &&
- t->time.tv_usec > nowP->tv_usec ) )
- break;
-
- /* Invalidate mstimeout cache, since we're modifying the queue */
- mstimeout_cache = -1;
-
- (t->timer_proc)( t->client_data, nowP );
- if ( t->periodic )
- {
- /* Reschedule. */
- t->time.tv_sec += t->msecs / 1000L;
- t->time.tv_usec += ( t->msecs % 1000L ) * 1000L;
- if ( t->time.tv_usec >= 1000000L )
- {
- t->time.tv_sec += t->time.tv_usec / 1000000L;
- t->time.tv_usec %= 1000000L;
- }
- l_resort( t );
- }
- else
- tmr_cancel( t );
- }
+tmr_run(struct timeval *nowP)
+{
+ int h;
+ Timer *t;
+ Timer *next;
+
+ for (h = 0; h < HASH_SIZE; ++h)
+ for (t = timers[h]; t != (Timer *) 0; t = next) {
+ next = t->next;
+ /* Since the lists are sorted, as soon as we find a timer
+ ** that isn't ready yet, we can go on to the next list.
+ */
+ if (t->time.tv_sec > nowP->tv_sec || (t->time.tv_sec == nowP->tv_sec && t->time.tv_usec > nowP->tv_usec))
+ break;
+
+ /* Invalidate mstimeout cache, since we're modifying the queue */
+ mstimeout_cache = -1;
+
+ (t->timer_proc) (t->client_data, nowP);
+ if (t->periodic) {
+ /* Reschedule. */
+ t->time.tv_sec += t->msecs / 1000L;
+ t->time.tv_usec += (t->msecs % 1000L) * 1000L;
+ if (t->time.tv_usec >= 1000000L) {
+ t->time.tv_sec += t->time.tv_usec / 1000000L;
+ t->time.tv_usec %= 1000000L;
+ }
+ l_resort(t);
+ } else
+ tmr_cancel(t);
}
+}
void
-tmr_reset( struct timeval* nowP, Timer* t )
- {
- mstimeout_cache = -1;
- t->time = *nowP;
- t->time.tv_sec += t->msecs / 1000L;
- t->time.tv_usec += ( t->msecs % 1000L ) * 1000L;
- if ( t->time.tv_usec >= 1000000L )
- {
- t->time.tv_sec += t->time.tv_usec / 1000000L;
- t->time.tv_usec %= 1000000L;
- }
- l_resort( t );
- }
+tmr_reset(struct timeval *nowP, Timer * t)
+{
+ mstimeout_cache = -1;
+ t->time = *nowP;
+ t->time.tv_sec += t->msecs / 1000L;
+ t->time.tv_usec += (t->msecs % 1000L) * 1000L;
+ if (t->time.tv_usec >= 1000000L) {
+ t->time.tv_sec += t->time.tv_usec / 1000000L;
+ t->time.tv_usec %= 1000000L;
+ }
+ l_resort(t);
+}
void
-tmr_cancel( Timer* t )
- {
- mstimeout_cache = -1;
- /* Remove it from its active list. */
- l_remove( t );
- /* And put it on the free list. */
- t->next = free_timers;
- free_timers = t;
- t->prev = (Timer*) 0;
- }
+tmr_cancel(Timer * t)
+{
+ mstimeout_cache = -1;
+ /* Remove it from its active list. */
+ l_remove(t);
+ /* And put it on the free list. */
+ t->next = free_timers;
+ free_timers = t;
+ t->prev = (Timer *) 0;
+}
void
-tmr_cleanup( void )
- {
- Timer* t;
-
- mstimeout_cache = -1;
- while ( free_timers != (Timer*) 0 )
- {
- t = free_timers;
- free_timers = t->next;
- free( (void*) t );
- }
- }
+tmr_cleanup(void)
+{
+ Timer *t;
+
+ mstimeout_cache = -1;
+ while (free_timers != (Timer *) 0) {
+ t = free_timers;
+ free_timers = t->next;
+ free((void *) t);
+ }
+}
void
-tmr_destroy( void )
- {
- int h;
+tmr_destroy(void)
+{
+ int h;
+
+ mstimeout_cache = -1;
+ for (h = 0; h < HASH_SIZE; ++h)
+ while (timers[h] != (Timer *) 0)
+ tmr_cancel(timers[h]);
+ tmr_cleanup();
- mstimeout_cache = -1;
- for ( h = 0; h < HASH_SIZE; ++h )
- while ( timers[h] != (Timer*) 0 )
- tmr_cancel( timers[h] );
- tmr_cleanup();
-
}
-
Modified: trafficserver/traffic/trunk/tools/http_load/timers.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/tools/http_load/timers.h?rev=1201984&r1=1201983&r2=1201984&view=diff
==============================================================================
--- trafficserver/traffic/trunk/tools/http_load/timers.h (original)
+++ trafficserver/traffic/trunk/tools/http_load/timers.h Tue Nov 15 00:47:01 2011
@@ -38,69 +38,70 @@
** can use it for whatever, and it gets passed to the callback when the
** timer triggers.
*/
-typedef union {
- void* p;
- int i;
- long l;
- } ClientData;
+typedef union
+{
+ void *p;
+ int i;
+ long l;
+} ClientData;
-extern ClientData JunkClientData; /* for use when you don't care */
+extern ClientData JunkClientData; /* for use when you don't care */
/* The TimerProc gets called when the timer expires. It gets passed
** the ClientData associated with the timer, and a timeval in case
** it wants to schedule another timer.
*/
-typedef void TimerProc( ClientData client_data, struct timeval* nowP );
+typedef void TimerProc(ClientData client_data, struct timeval *nowP);
/* The Timer struct. */
-typedef struct TimerStruct {
- TimerProc* timer_proc;
- ClientData client_data;
- long msecs;
- int periodic;
- struct timeval time;
- struct TimerStruct* prev;
- struct TimerStruct* next;
- int hash;
- } Timer;
+typedef struct TimerStruct
+{
+ TimerProc *timer_proc;
+ ClientData client_data;
+ long msecs;
+ int periodic;
+ struct timeval time;
+ struct TimerStruct *prev;
+ struct TimerStruct *next;
+ int hash;
+} Timer;
/* Initialize the timer package. */
-extern void tmr_init( void );
+extern void tmr_init(void);
/* Set up a timer, either periodic or one-shot. Returns (Timer*) 0 on errors. */
-extern Timer* tmr_create(
- struct timeval* nowP, TimerProc* timer_proc, ClientData client_data,
- long msecs, int periodic );
+extern Timer *tmr_create(struct timeval *nowP, TimerProc * timer_proc, ClientData client_data,
+ long msecs, int periodic);
/* Returns a timeout indicating how long until the next timer triggers. You
** can just put the call to this routine right in your select(). Returns
** (struct timeval*) 0 if no timers are pending.
*/
-extern struct timeval* tmr_timeout( struct timeval* nowP );
+extern struct timeval *tmr_timeout(struct timeval *nowP);
/* Returns a timeout in milliseconds indicating how long until the next timer
** triggers. You can just put the call to this routine right in your poll().
** Returns INFTIM (-1) if no timers are pending.
*/
-extern long tmr_mstimeout( struct timeval* nowP );
+extern long tmr_mstimeout(struct timeval *nowP);
/* Run the list of timers. Your main program needs to call this every so often,
** or as indicated by tmr_timeout().
*/
-extern void tmr_run( struct timeval* nowP );
+extern void tmr_run(struct timeval *nowP);
/* Reset the clock on a timer, to current time plus the original timeout. */
-extern void tmr_reset( struct timeval* nowP, Timer* timer );
+extern void tmr_reset(struct timeval *nowP, Timer * timer);
/* Deschedule a timer. Note that non-periodic timers are automatically
** descheduled when they run, so you don't have to call this on them.
*/
-extern void tmr_cancel( Timer* timer );
+extern void tmr_cancel(Timer * timer);
/* Clean up the timers package, freeing any unused storage. */
-extern void tmr_cleanup( void );
+extern void tmr_cleanup(void);
/* Cancel all timers and free storage, usually in preparation for exitting. */
-extern void tmr_destroy( void );
+extern void tmr_destroy(void);
#endif /* _TIMERS_H_ */