Commit 5741be0b authored by Bob Halley's avatar Bob Halley
Browse files

add event destructor

parent 6d05b41a
......@@ -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;
};
......
......@@ -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;
......
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