mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Fix the task unit test
The timers can be destroyed while the timer actions are still running, and when the action calls isc_event_free() it can assert, because it's trying to access the destroyed timer object. Before destroying the timers, first disable them, then wait 2 seconds of grace period before destroying them.
This commit is contained in:
parent
24ba32450d
commit
a6aee6a95e
1 changed files with 10 additions and 0 deletions
|
|
@ -571,7 +571,17 @@ ISC_RUN_TEST_IMPL(basic) {
|
|||
|
||||
atomic_store(&done, true);
|
||||
|
||||
/* Let everything run for 10 seconds. */
|
||||
sleep(10);
|
||||
|
||||
/*
|
||||
* Disable the timers, let all the already dispatched events to
|
||||
* complete, and then destroy the timers.
|
||||
*/
|
||||
(void)isc_timer_reset(ti1, isc_timertype_inactive, NULL, NULL, true);
|
||||
(void)isc_timer_reset(ti2, isc_timertype_inactive, NULL, NULL, true);
|
||||
(void)isc_timer_reset(ti3, isc_timertype_inactive, NULL, NULL, true);
|
||||
sleep(4);
|
||||
isc_timer_destroy(&ti1);
|
||||
isc_timer_destroy(&ti2);
|
||||
LOCK(&lock);
|
||||
|
|
|
|||
Loading…
Reference in a new issue