From 5741be0b804158bb4b4f9f83e3b0099eec0ef4f2 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Tue, 3 Nov 1998 19:05:12 +0000 Subject: [PATCH] add event destructor --- lib/isc/include/isc/task.h | 2 ++ lib/isc/task.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h index 8833ec08eb..48d6eff1a6 100644 --- a/lib/isc/include/isc/task.h +++ b/lib/isc/include/isc/task.h @@ -32,6 +32,7 @@ typedef struct isc_taskmgr * isc_taskmgr_t; typedef int isc_eventtype_t; typedef isc_boolean_t (*isc_taskaction_t)(isc_task_t, isc_event_t); +typedef void (*isc_eventdestructor_t)(isc_event_t); /* * This structure is public because "subclassing" it may be useful when @@ -44,6 +45,7 @@ struct isc_event { isc_eventtype_t type; isc_taskaction_t action; void * arg; + isc_eventdestructor_t destroy; LINK(struct isc_event) link; }; diff --git a/lib/isc/task.c b/lib/isc/task.c index 11f379979d..b48cac3f20 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -142,6 +142,8 @@ isc_event_free(isc_event_t *eventp) { event = *eventp; REQUIRE(event != NULL); + if (event->destroy != NULL) + (event->destroy)(event); isc_mem_put(event->mctx, event, event->size); *eventp = NULL;