mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-10 20:29:59 -04:00
add event destructor
This commit is contained in:
parent
6d05b41aae
commit
5741be0b80
2 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue