Commit 07697f1c authored by Bob Halley's avatar Bob Halley

tagged event support

parent 3bb3f7ca
......@@ -180,7 +180,7 @@ isc_task_send(isc_task_t *task, isc_event_t **eventp);
unsigned int
isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
isc_eventtype_t last);
isc_eventtype_t last, unsigned int tag);
/*
* Purge events from a task's event queue.
*
......@@ -194,7 +194,8 @@ isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
*
* Events whose sender is 'sender', and whose type is >= first and
* <= last will be purged, unless they are marked as unpurgable.
* A sender of NULL will match any sender.
* A sender of NULL will match any sender. A tag of zero matches any
* tag.
*
* Returns:
*
......@@ -202,7 +203,8 @@ isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
*/
unsigned int
isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type);
isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type,
unsigned int tag);
/*
* Purge events from a task's event queue.
*
......@@ -210,7 +212,7 @@ isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type);
*
* This function is equivalent to
*
* isc_task_purgerange(task, sender, type, type);
* isc_task_purgerange(task, sender, type, type, tag);
*
* Requires:
*
......@@ -222,7 +224,8 @@ isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type);
*
* Events whose sender is 'sender', and whose type is 'type'
* will be purged, unless they are marked as unpurgable.
* A sender of NULL will match any sender.
* A sender of NULL will match any sender. A tag of zero matches any
* tag.
*
* Returns:
*
......
......@@ -331,7 +331,7 @@ isc_task_send(isc_task_t *task, isc_event_t **eventp) {
unsigned int
isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
isc_eventtype_t last)
isc_eventtype_t last, unsigned int tag)
{
isc_event_t *event, *next_event;
isc_eventlist_t purgeable;
......@@ -344,6 +344,9 @@ isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
REQUIRE(VALID_TASK(task));
REQUIRE(last >= first);
XTRACE("purgerange");
/*
* Events matching 'sender' and whose type is >= first and
* <= last will be purged, unless they are marked as unpurgable.
......@@ -360,9 +363,9 @@ isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
event != NULL;
event = next_event) {
next_event = NEXT(event, link);
if ((sender == NULL || event->sender == sender) &&
event->type >= first &&
event->type <= last &&
if (event->type >= first && event->type <= last &&
(sender == NULL || event->sender == sender) &&
(tag == 0 || event->tag == tag) &&
(event->attributes & ISC_EVENTATTR_NOPURGE) == 0) {
DEQUEUE(task->events, event, link);
ENQUEUE(purgeable, event, link);
......@@ -382,13 +385,14 @@ isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
}
unsigned int
isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type) {
isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type,
unsigned int tag)
{
/*
* Purge events from a task's event queue.
*/
return (isc_task_purgerange(task, sender, type, type));
return (isc_task_purgerange(task, sender, type, type, tag));
}
isc_boolean_t
......
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