|
| iMatix home page | << | < | > | >> |
SMTVersion 2.81 |
#include "smtlib.h"
int
event_expire (
QUEUE *queue, /* Queue to take event from */
EVENT *event /* Event, or null for first */
)
Expires the next event or a specific event on an event queue. Sends a 'expired' event to the original sender if required, then destroys the event. You can use this to expire one specific message, or in a loop to cancel the entire queue. Returns 0 if the event was successfully expired, else returns - 1 and sets smt_errno to one of:
| SMT NOTREADY | smt_init() was not called, or failed |
| SMT QUEUEISEMPTY | The queue was empty |
{
#if (defined (SMT_TRACE))
trace ("event_expire");
#endif
ASSERT (queue);
if (!smt_alive) /* If SMT API was not correctly */
{ /* initialised, forget it */
smt_errno = SMT_NOTREADY;
return (-1);
}
if ((event = event_locate (queue, event)) == NULL)
return (-1);
/* Reply to original sender if necessary */
if (event-> expire_event)
event send (
&event-> sender, /* Send back to original sender */
NULL, /* No queue for reply */
event-> expire_event, /* Name of event to send */
NULL, 0, /* Body is empty, size is 0 */
NULL, NULL, NULL, /* No response events */
0); /* No timeout */
/* Unlink and destroy event */
return (event discard (queue, event));
}
| | << | < | > | >> |
|