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

 

event_reject

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

Synopsis

Rejects the next event or a specific event on an event queue. Sends a 'rejected' event to the original sender if required, then destroys the event. You can use this to reject one specific message, or in a loop to cancel the entire queue. Returns 0 if the event was successfully rejected, 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_reject");
#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-> reject_event)
        event send (
            &event-> sender,            /*  Send back to original sender     */
            NULL,                       /*  No queue for reply               */
            event-> reject_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