Commit b3224830 authored by Bob Halley's avatar Bob Halley
Browse files

the event action is now responsible for freeing the event memory

parent b592e197
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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) {
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment