2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 00:25:29 +00:00

the event action is now responsible for freeing the event memory

This commit is contained in:
Bob Halley
1998-10-28 01:45:43 +00:00
parent b592e197fe
commit b32248301c
3 changed files with 18 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ my_callback(isc_task_t task, isc_event_t event)
for (i = 0; i < 1000000; i++) for (i = 0; i < 1000000; i++)
j += 100; j += 100;
printf("task %s (%p): %d\n", name, task, j); printf("task %s (%p): %d\n", name, task, j);
isc_event_free(&event);
return (ISC_FALSE); return (ISC_FALSE);
} }
@@ -33,6 +34,8 @@ my_shutdown(isc_task_t task, isc_event_t event) {
char *name = event->arg; char *name = event->arg;
printf("shutdown %s (%p)\n", name, task); printf("shutdown %s (%p)\n", name, task);
isc_event_free(&event);
return (ISC_TRUE); return (ISC_TRUE);
} }
@@ -42,6 +45,8 @@ my_tick(isc_task_t task, isc_event_t event)
char *name = event->arg; char *name = event->arg;
printf("task %p tick %s\n", task, name); printf("task %p tick %s\n", task, name);
isc_event_free(&event);
return (ISC_FALSE); return (ISC_FALSE);
} }

View File

@@ -22,6 +22,8 @@ shutdown_task(isc_task_t task, isc_event_t event) {
char *name = event->arg; char *name = event->arg;
printf("task %p shutdown %s\n", task, name); printf("task %p shutdown %s\n", task, name);
isc_event_free(&event);
return (ISC_TRUE); return (ISC_TRUE);
} }
@@ -35,10 +37,10 @@ tick(isc_task_t task, isc_event_t event)
printf("task %s (%p) tick\n", name, task); printf("task %s (%p) tick\n", name, task);
tick_count++; tick_count++;
if (tick_count % 3 == 0) if (ti3 != NULL && tick_count % 3 == 0)
isc_timer_touch(ti3); isc_timer_touch(ti3);
if (tick_count == 7) { if (ti3 != NULL && tick_count == 7) {
struct isc_time expires, now; struct isc_time expires, now;
struct isc_interval interval; struct isc_interval interval;
@@ -52,6 +54,8 @@ tick(isc_task_t task, isc_event_t event)
== ISC_R_SUCCESS); == ISC_R_SUCCESS);
} }
isc_event_free(&event);
return (ISC_FALSE); return (ISC_FALSE);
} }
@@ -72,8 +76,12 @@ timeout(isc_task_t task, isc_event_t event)
if (strcmp(name, "3") == 0) { if (strcmp(name, "3") == 0) {
printf("*** saving task 3 ***\n"); printf("*** saving task 3 ***\n");
isc_event_free(&event);
return (ISC_FALSE); return (ISC_FALSE);
} }
isc_event_free(&event);
return (ISC_TRUE); return (ISC_TRUE);
} }

View File

@@ -384,7 +384,7 @@ isc_task_shutdown(isc_task_t task) {
REQUIRE(VALID_TASK(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); LOCK(&task->lock);
@@ -500,7 +500,7 @@ run(void *uap) {
while (!FINISHED(manager)) { while (!FINISHED(manager)) {
/* /*
* For reasons similar to those given in the comment in * 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 * the task while only holding the manager lock, and then
* change the task to running state while only holding the * change the task to running state while only holding the
* task lock. * task lock.
@@ -569,8 +569,6 @@ run(void *uap) {
wants_shutdown = ISC_FALSE; wants_shutdown = ISC_FALSE;
dispatch_count++; dispatch_count++;
isc_event_free(&event);
LOCK(&task->lock); LOCK(&task->lock);
if (wants_shutdown || is_shutdown) { if (wants_shutdown || is_shutdown) {
/* /*