mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
isc_interval_t conversion
This commit is contained in:
parent
5cc3e0c38f
commit
db1e643c60
@ -54,7 +54,8 @@ main(int argc, char *argv[]) {
|
||||
unsigned int workers;
|
||||
isc_timermgr_t timgr;
|
||||
isc_timer_t ti1, ti2;
|
||||
struct isc_time absolute, interval;
|
||||
struct isc_time absolute;
|
||||
struct isc_interval interval;
|
||||
|
||||
if (argc > 1)
|
||||
workers = atoi(argv[1]);
|
||||
@ -79,14 +80,14 @@ main(int argc, char *argv[]) {
|
||||
timgr = NULL;
|
||||
INSIST(isc_timermgr_create(mctx, &timgr) == ISC_R_SUCCESS);
|
||||
ti1 = NULL;
|
||||
absolute.seconds = 0;
|
||||
absolute.nanoseconds = 0;
|
||||
interval.seconds = 1;
|
||||
interval.nanoseconds = 0;
|
||||
isc_time_settoepoch(&absolute);
|
||||
isc_interval_set(&interval, 1, 0);
|
||||
INSIST(isc_timer_create(timgr, isc_timertype_ticker,
|
||||
&absolute, &interval,
|
||||
t1, my_tick, "foo", &ti1) == ISC_R_SUCCESS);
|
||||
ti2 = NULL;
|
||||
isc_time_settoepoch(&absolute);
|
||||
isc_interval_set(&interval, 1, 0);
|
||||
INSIST(isc_timer_create(timgr, isc_timertype_ticker,
|
||||
&absolute, &interval,
|
||||
t2, my_tick, "bar", &ti2) == ISC_R_SUCCESS);
|
||||
|
@ -39,14 +39,13 @@ tick(isc_task_t task, isc_event_t event)
|
||||
isc_timer_touch(ti3);
|
||||
|
||||
if (tick_count == 7) {
|
||||
struct isc_time expires, interval, now;
|
||||
struct isc_time expires, now;
|
||||
struct isc_interval interval;
|
||||
|
||||
(void)isc_time_get(&now);
|
||||
expires.seconds = 5;
|
||||
expires.nanoseconds = 0;
|
||||
isc_time_add(&now, &expires, &expires);
|
||||
interval.seconds = 4;
|
||||
interval.nanoseconds = 0;
|
||||
isc_interval_set(&interval, 5, 0);
|
||||
isc_time_add(&now, &interval, &expires);
|
||||
isc_interval_set(&interval, 4, 0);
|
||||
printf("*** resetting ti3 ***\n");
|
||||
INSIST(isc_timer_reset(ti3, isc_timertype_once, &expires,
|
||||
&interval, ISC_TRUE)
|
||||
@ -83,7 +82,8 @@ main(int argc, char *argv[]) {
|
||||
isc_taskmgr_t manager = NULL;
|
||||
isc_timermgr_t timgr = NULL;
|
||||
unsigned int workers;
|
||||
struct isc_time expires, interval, now;
|
||||
struct isc_time expires, now;
|
||||
struct isc_interval interval;
|
||||
|
||||
if (argc > 1)
|
||||
workers = atoi(argv[1]);
|
||||
@ -108,24 +108,18 @@ main(int argc, char *argv[]) {
|
||||
|
||||
(void)isc_time_get(&now);
|
||||
|
||||
expires.seconds = 0;
|
||||
expires.nanoseconds = 0;
|
||||
interval.seconds = 2;
|
||||
interval.nanoseconds = 0;
|
||||
isc_time_settoepoch(&expires);
|
||||
isc_interval_set(&interval, 2, 0);
|
||||
INSIST(isc_timer_create(timgr, isc_timertype_once, &expires, &interval,
|
||||
t2, timeout, "2", &ti2) == ISC_R_SUCCESS);
|
||||
expires.seconds = 0;
|
||||
expires.nanoseconds = 0;
|
||||
interval.seconds = 1;
|
||||
interval.nanoseconds = 0;
|
||||
isc_time_settoepoch(&expires);
|
||||
isc_interval_set(&interval, 1, 0);
|
||||
INSIST(isc_timer_create(timgr, isc_timertype_ticker,
|
||||
&expires, &interval,
|
||||
t1, tick, "1", &ti1) == ISC_R_SUCCESS);
|
||||
expires.seconds = 10;
|
||||
expires.nanoseconds = 0;
|
||||
isc_time_add(&now, &expires, &expires);
|
||||
interval.seconds = 2;
|
||||
interval.nanoseconds = 0;
|
||||
isc_interval_set(&interval, 10, 0);
|
||||
isc_time_add(&now, &interval, &expires);
|
||||
isc_interval_set(&interval, 2, 0);
|
||||
INSIST(isc_timer_create(timgr, isc_timertype_once, &expires, &interval,
|
||||
t3, timeout, "3", &ti3) == ISC_R_SUCCESS);
|
||||
|
||||
|
@ -92,7 +92,7 @@ isc_result_t
|
||||
isc_timer_create(isc_timermgr_t manager,
|
||||
isc_timertype_t type,
|
||||
isc_time_t expires,
|
||||
isc_time_t interval,
|
||||
isc_interval_t interval,
|
||||
isc_task_t task,
|
||||
isc_taskaction_t action,
|
||||
void *arg,
|
||||
@ -147,7 +147,7 @@ isc_result_t
|
||||
isc_timer_reset(isc_timer_t timer,
|
||||
isc_timertype_t type,
|
||||
isc_time_t expires,
|
||||
isc_time_t interval,
|
||||
isc_interval_t interval,
|
||||
isc_boolean_t purge);
|
||||
/*
|
||||
* Change the timer's type, expires, and interval values to the given
|
||||
|
Loading…
x
Reference in New Issue
Block a user