IP_QueueWait

IP_QueueWait — requests notification of an event.

Syntax

#include <cogent.h>
int IP_QueueWait(int  qid,
 int  pulse,
 int  eventmask);

Arguments

qid

The queue ID.

pulse

A pulse ID.

eventmask

The event on which to wait.

Returns

0 on success, or -1 on failure and errno is set.

Description

This function causes qserve to trigger the pulse when a particular event occurs. The calling process does not block waiting for the next event, but will return immediately. In order to implement a blocking wait, the programmer should use IP_QueueWait followed by IP_Receive.

The possible values for eventmask are:

    IP_NOTIFY_MSG notifies the caller when the next message is available. This event causes at most one pulse trigger.

    IP_NOTIFY_EVERY_MSG notifies the caller when every message is available. This event will cause on pulse trigger for each message that arrives in the queue.

    IP_NOTIFY_SPACE notifies the caller when the queue transitions from full to non-full. This event causes at most one pulse trigger.

    IP_NOTIFY_ANY_SPACE notifies the caller whenever the queue transitions from full to non-full.

    IP_NOTIFY_HALF_SPACE notifies the caller when the queue transitions from half-full to less than half-full. This event causes at most one pulse trigger.

    IP_NOTIFY_ANY_HALF_SPACE notifies the caller whenever the queue transitions from half-full to less than half-full.

If the condition for an event is already true at the time of the call to IP_QueueWait, then the pulse is triggered immediately.

See Also

Cascade QueueServer Functions, Pulses and Timers