| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

event_expire

#include "smtlib.h"
int
event_expire (
    QUEUE *queue,                       /*  Queue to take event from         */
    EVENT *event                        /*  Event, or null for first         */
)

Synopsis

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

Source Code - (smtlib.c)

{
#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));
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation