Repair isc_task_purgeevent(), clean isc_task_unsend{,range}()
The isc_task_purgerange() was walking through all events on the task to find a matching task. Instead use the ISC_LINK_LINKED to find whether the event is active. Cleanup the related isc_task_unsend() and isc_task_unsendrange() functions that were not used anywhere.
This commit is contained in:
@@ -612,12 +612,10 @@ isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type,
|
||||
|
||||
bool
|
||||
isc_task_purgeevent(isc_task_t *task, isc_event_t *event) {
|
||||
isc_event_t *curr_event, *next_event;
|
||||
bool found = false;
|
||||
|
||||
/*
|
||||
* Purge 'event' from a task's event queue.
|
||||
*
|
||||
* XXXRTH: WARNING: This method may be removed before beta.
|
||||
*/
|
||||
|
||||
REQUIRE(VALID_TASK(task));
|
||||
@@ -633,52 +631,22 @@ isc_task_purgeevent(isc_task_t *task, isc_event_t *event) {
|
||||
*/
|
||||
|
||||
LOCK(&task->lock);
|
||||
for (curr_event = HEAD(task->events); curr_event != NULL;
|
||||
curr_event = next_event)
|
||||
{
|
||||
next_event = NEXT(curr_event, ev_link);
|
||||
if (curr_event == event && PURGE_OK(event)) {
|
||||
DEQUEUE(task->events, curr_event, ev_link);
|
||||
task->nevents--;
|
||||
break;
|
||||
}
|
||||
if (ISC_LINK_LINKED(event, ev_link)) {
|
||||
DEQUEUE(task->events, event, ev_link);
|
||||
task->nevents--;
|
||||
found = true;
|
||||
}
|
||||
UNLOCK(&task->lock);
|
||||
|
||||
if (curr_event == NULL) {
|
||||
if (!found) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
isc_event_free(&curr_event);
|
||||
isc_event_free(&event);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first,
|
||||
isc_eventtype_t last, void *tag, isc_eventlist_t *events) {
|
||||
/*
|
||||
* Remove events from a task's event queue.
|
||||
*/
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
XTRACE("isc_task_unsendrange");
|
||||
|
||||
return (dequeue_events(task, sender, first, last, tag, events, false));
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag,
|
||||
isc_eventlist_t *events) {
|
||||
/*
|
||||
* Remove events from a task's event queue.
|
||||
*/
|
||||
|
||||
XTRACE("isc_task_unsend");
|
||||
|
||||
return (dequeue_events(task, sender, type, type, tag, events, false));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, void *arg) {
|
||||
bool disallowed = false;
|
||||
|
||||
Reference in New Issue
Block a user