add event destructor
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user