Adapt to the new ng_timeout/ng_untimeout arguments. These now use

the callout instead of the timeout interface.

Submitted by:	glebius
This commit is contained in:
Hartmut Brandt 2004-11-04 12:33:55 +00:00
parent 56f7479530
commit a6fd48812e
2 changed files with 11 additions and 17 deletions

View File

@ -105,18 +105,16 @@
/*
* Timer support.
*/
typedef struct callout_handle sscop_timer_t;
#define TIMER_INIT(S, T) callout_handle_init(&(S)->t_##T)
typedef struct callout sscop_timer_t;
#define TIMER_INIT(S, T) ng_callout_init(&(S)->t_##T)
#define TIMER_STOP(S,T) do { \
ng_untimeout((S)->t_##T, (S)->aarg); \
callout_handle_init(&(S)->t_##T); \
ng_untimeout(&(S)->t_##T, (S)->aarg); \
} while (0)
#define TIMER_RESTART(S, T) do { \
TIMER_STOP(S, T); \
(S)->t_##T = ng_timeout((S)->aarg, NULL, \
ng_timeout(&(S)->t_##T, (S)->aarg, NULL, \
hz * (S)->timer##T / 1000, T##_func, (S), 0); \
} while (0)
#define TIMER_ISACT(S, T) ((S)->t_##T.callout != NULL)
#define TIMER_ISACT(S, T) ((S)->t_##T.c_flags & (CALLOUT_PENDING))
/*
* This assumes, that the user argument is the node pointer.
@ -127,7 +125,6 @@ T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
{ \
struct sscop *sscop = arg1; \
\
callout_handle_init(&sscop->t_##T); \
VERBOSE(sscop, SSCOP_DBG_TIMER, (sscop, sscop->aarg, \
"timer_" #T " expired")); \
sscop_signal(sscop, SIG_T_##N, NULL); \

View File

@ -79,19 +79,19 @@ void ng_uni_free(enum unimem, void *, const char *, u_int);
* Timers
*/
struct uni_timer {
struct callout_handle c;
struct callout c;
};
#define _TIMER_INIT(X,T) callout_handle_init(&(X)->T.c)
#define _TIMER_INIT(X,T) ng_callout_init(&(X)->T.c)
#define _TIMER_DESTROY(UNI,FIELD) _TIMER_STOP(UNI,FIELD)
#define _TIMER_STOP(UNI,FIELD) do { \
ng_untimeout(FIELD.c, (UNI)->arg); \
callout_handle_init(&FIELD.c); \
ng_untimeout(&FIELD.c, (UNI)->arg); \
} while (0)
#define TIMER_ISACT(UNI,T) ((UNI)->T.c.callout != NULL)
#define TIMER_ISACT(UNI,T) ((UNI)->T.c.c_flags & (CALLOUT_ACTIVE | \
CALLOUT_PENDING))
#define _TIMER_START(UNI,ARG,FIELD,DUE,FUNC) do { \
_TIMER_STOP(UNI, FIELD); \
FIELD.c = ng_timeout((UNI)->arg, NULL, \
ng_timeout(&FIELD.c, (UNI)->arg, NULL, \
hz * (DUE) / 1000, FUNC, (ARG), 0); \
} while (0)
@ -102,7 +102,6 @@ _##T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
{ \
struct uni *uni = (struct uni *)arg1; \
\
callout_handle_init(&uni->T.c); \
(F)(uni); \
uni_work(uni); \
}
@ -118,7 +117,6 @@ _##T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
struct call *call = (struct call *)arg1; \
struct uni *uni = call->uni; \
\
callout_handle_init(&call->T.c); \
(F)(call); \
uni_work(uni); \
}
@ -134,7 +132,6 @@ _##T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
struct party *party = (struct party *)arg1; \
struct uni *uni = party->call->uni; \
\
callout_handle_init(&party->T.c); \
(F)(party); \
uni_work(uni); \
}