IP_TaskWaitAsync

IP_TaskWaitAsync — registers the task for events in qserve.

Syntax

#include <cogent.h>
int IP_TaskWaitAsync(IP_Task*  task,
 int  flags);

Arguments

task

A pointer to a task structure.

flags

The event on which to wait.

Returns

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

Description

This function causes the current task to be notified whenever the events in flags occur within qserve. This function will create a pulse, stored in task->qpulse, if necessary. When the event occurs, task->qpulse will be triggered, and will subsequently be received through IP_Receive as an IP_PULSE event type.

The possible values for flags 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.

The programmer should not make this call with a task structure referring to the current process, as it is done automatically by the API.

See Also

Task Structures, IP_TaskInitAsync, IP_TaskSendAsync, IP_TaskCloseAsync