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

 

queue_flush

#include "smtlib.h"
int
queue_flush (
    QUEUE *queue                        /*  Queue to flush                   */
)

Synopsis

Expires any out-of-date events in the queue: calls event expire() for each event who's timeout has passed. Returns the number of events expired. In case of error, returns -1 and sets smt_errno to one of these values:
SMT NOTREADY smt_init() was not called, or failed
SMT NOSUCHQUEUE The event queue is not defined

Source Code - (smtlib.c)

{
    time_t  time_now;                   /*  Current time                     */
    int     feedback = 0;               /*  Number of events we delivered    */
    EVENT   *event;                     /*  Event information block          */

#if (defined (SMT_TRACE))
    trace ("queue_flush");
#endif
    ASSERT (queue);
    if (!smt_alive)                     /*  If SMT API was not correctly     */
      {                                 /*    initialised, forget it         */
        smt_errno = SMT_NOTREADY;
        return (-1);
      }

    time_now = time (NULL);
    FORLIST (event, queue-> events)
        if (event-> timeout && event-> timeout < time_now)
          {
            event expire (queue, event);
            feedback++;
          }

    return (feedback);
}

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