2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 17:15:31 +00:00

1527. [cleanup] Reduce the number of gettimeofday() calls without

losing necessary timer granularity.

(reviewed by marka and Kurt)
This commit is contained in:
Tatuya JINMEI 神明達哉
2003-10-25 00:09:14 +00:00
parent 8cb1558ff8
commit 6da7c87a77
5 changed files with 62 additions and 15 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: task.c,v 1.88 2002/07/19 03:39:43 marka Exp $ */
/* $Id: task.c,v 1.89 2003/10/25 00:09:13 jinmei Exp $ */
/*
* Principal Author: Bob Halley
@@ -82,6 +82,7 @@ struct isc_task {
isc_eventlist_t on_shutdown;
unsigned int quantum;
unsigned int flags;
isc_stdtime_t now;
#ifdef ISC_TASK_NAMES
char name[16];
void * tag;
@@ -196,6 +197,7 @@ isc_task_create(isc_taskmgr_t *manager, unsigned int quantum,
INIT_LIST(task->on_shutdown);
task->quantum = quantum;
task->flags = 0;
task->now = 0;
#ifdef ISC_TASK_NAMES
memset(task->name, 0, sizeof(task->name));
task->tag = NULL;
@@ -717,6 +719,17 @@ isc_task_gettag(isc_task_t *task) {
return (task->tag);
}
void
isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t) {
REQUIRE(VALID_TASK(task));
REQUIRE(t != NULL);
LOCK(&task->lock);
*t = task->now;
UNLOCK(&task->lock);
}
/***
*** Task Manager.
@@ -838,6 +851,7 @@ dispatch(isc_taskmgr_t *manager) {
task->state = task_state_running;
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
ISC_MSG_RUNNING, "running"));
isc_stdtime_get(&task->now);
do {
if (!EMPTY(task->events)) {
event = HEAD(task->events);