summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/isc/timer.c
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2007-12-02 19:10:41 +0000
committerdougb <dougb@FreeBSD.org>2007-12-02 19:10:41 +0000
commita71024a14b827f5b701147352017a851b29079f1 (patch)
tree53a2dee8ac1ac0a8ab5297f2d49a8f8514d535f4 /contrib/bind9/lib/isc/timer.c
parente9f5980a15892cbb50c32cfaab95f2dcb23cebcd (diff)
downloadFreeBSD-src-a71024a14b827f5b701147352017a851b29079f1.zip
FreeBSD-src-a71024a14b827f5b701147352017a851b29079f1.tar.gz
Vendor import of BIND 9.4.2
Diffstat (limited to 'contrib/bind9/lib/isc/timer.c')
-rw-r--r--contrib/bind9/lib/isc/timer.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/contrib/bind9/lib/isc/timer.c b/contrib/bind9/lib/isc/timer.c
index 4b96fa5..f67d091 100644
--- a/contrib/bind9/lib/isc/timer.c
+++ b/contrib/bind9/lib/isc/timer.c
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2002 Internet Software Consortium.
*
- * Permission to use, copy, modify, and distribute this software for any
+ * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.73.18.5 2005/11/30 03:44:39 marka Exp $ */
+/* $Id: timer.c,v 1.73.18.7 2007/10/24 23:46:26 tbox Exp $ */
/*! \file */
@@ -581,6 +581,7 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
isc_eventtype_t type = 0;
isc_timer_t *timer;
isc_result_t result;
+ isc_boolean_t idle;
/*!
* The caller must be holding the manager lock.
@@ -612,23 +613,33 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
type = ISC_TIMEREVENT_LIFE;
post_event = ISC_TRUE;
need_schedule = ISC_FALSE;
- } else if (!isc_time_isepoch(&timer->idle) &&
- isc_time_compare(now,
- &timer->idle) >= 0) {
- type = ISC_TIMEREVENT_IDLE;
- post_event = ISC_TRUE;
- need_schedule = ISC_FALSE;
} else {
- /*
- * Idle timer has been touched; reschedule.
- */
- XTRACEID(isc_msgcat_get(isc_msgcat,
- ISC_MSGSET_TIMER,
- ISC_MSG_IDLERESCHED,
- "idle reschedule"),
- timer);
- post_event = ISC_FALSE;
- need_schedule = ISC_TRUE;
+ idle = ISC_FALSE;
+
+ LOCK(&timer->lock);
+ if (!isc_time_isepoch(&timer->idle) &&
+ isc_time_compare(now,
+ &timer->idle) >= 0) {
+ idle = ISC_TRUE;
+ }
+ UNLOCK(&timer->lock);
+ if (idle) {
+ type = ISC_TIMEREVENT_IDLE;
+ post_event = ISC_TRUE;
+ need_schedule = ISC_FALSE;
+ } else {
+ /*
+ * Idle timer has been touched;
+ * reschedule.
+ */
+ XTRACEID(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TIMER,
+ ISC_MSG_IDLERESCHED,
+ "idle reschedule"),
+ timer);
+ post_event = ISC_FALSE;
+ need_schedule = ISC_TRUE;
+ }
}
if (post_event) {
OpenPOWER on IntegriCloud