diff --git a/bin/tests/task_test.c b/bin/tests/task_test.c index c968cf3a07..7992f239e5 100644 --- a/bin/tests/task_test.c +++ b/bin/tests/task_test.c @@ -24,7 +24,8 @@ my_callback(isc_task_t task, isc_event_t event) for (i = 0; i < 1000000; i++) j += 100; printf("task %s (%p): %d\n", name, task, j); - + isc_event_free(&event); + return (ISC_FALSE); } @@ -33,6 +34,8 @@ my_shutdown(isc_task_t task, isc_event_t event) { char *name = event->arg; printf("shutdown %s (%p)\n", name, task); + isc_event_free(&event); + return (ISC_TRUE); } @@ -42,6 +45,8 @@ my_tick(isc_task_t task, isc_event_t event) char *name = event->arg; printf("task %p tick %s\n", task, name); + isc_event_free(&event); + return (ISC_FALSE); } diff --git a/bin/tests/timer_test.c b/bin/tests/timer_test.c index c9fa67a70c..bb536b647d 100644 --- a/bin/tests/timer_test.c +++ b/bin/tests/timer_test.c @@ -22,6 +22,8 @@ shutdown_task(isc_task_t task, isc_event_t event) { char *name = event->arg; printf("task %p shutdown %s\n", task, name); + isc_event_free(&event); + return (ISC_TRUE); } @@ -35,10 +37,10 @@ tick(isc_task_t task, isc_event_t event) printf("task %s (%p) tick\n", name, task); tick_count++; - if (tick_count % 3 == 0) + if (ti3 != NULL && tick_count % 3 == 0) isc_timer_touch(ti3); - if (tick_count == 7) { + if (ti3 != NULL && tick_count == 7) { struct isc_time expires, now; struct isc_interval interval; @@ -52,6 +54,8 @@ tick(isc_task_t task, isc_event_t event) == ISC_R_SUCCESS); } + isc_event_free(&event); + return (ISC_FALSE); } @@ -72,8 +76,12 @@ timeout(isc_task_t task, isc_event_t event) if (strcmp(name, "3") == 0) { printf("*** saving task 3 ***\n"); + isc_event_free(&event); return (ISC_FALSE); } + + isc_event_free(&event); + return (ISC_TRUE); } diff --git a/lib/isc/task.c b/lib/isc/task.c index 3386539c1b..11f379979d 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -384,7 +384,7 @@ isc_task_shutdown(isc_task_t task) { REQUIRE(VALID_TASK(task)); /* - * This routine is very similar to isc_task_send_event() above. + * This routine is very similar to isc_task_send() above. */ LOCK(&task->lock); @@ -500,7 +500,7 @@ run(void *uap) { while (!FINISHED(manager)) { /* * For reasons similar to those given in the comment in - * isc_task_send_event() above, it is safe for us to dequeue + * isc_task_send() above, it is safe for us to dequeue * the task while only holding the manager lock, and then * change the task to running state while only holding the * task lock. @@ -569,8 +569,6 @@ run(void *uap) { wants_shutdown = ISC_FALSE; dispatch_count++; - isc_event_free(&event); - LOCK(&task->lock); if (wants_shutdown || is_shutdown) { /*