a0WaitAnyRequest()

Waits for any request of a table to complete.


Syntax

a0tError a0WaitAnyRequest(
a0tRequest *requestab[],
int size,
int *index );

Arguments

Namerd/wrDescription
requestab write Table of requests to wait for.
size write Size of the table.
index write Result of the wait.

Description

This function blocks the calling thread until one of the previous requests specified in the table requestab has already completed. The size of the table must be specified in size. After the completion of one of the requests, it can't be waited or tested anymore.

The table requesttab must be constructed by the caller thread with pointers to all the requests to be tested. After a completed request, the caller thread doesn't need to bother to rebuild the table to reuse it. The function a0WaitAnyRequest() replaces the pointer of the completed request by NULL and it doesn't complaint if a pointer is NULL in requestab. Though, a NULL pointer is also counted in size.

It returns in index the index of the completed request in the table. It also inserts in the respective completed request structure its final status (see a0GetRequestData()).


Return Values

If an error condition occurs, it returns the error code, otherwise it returns A0ErrOk. Possible values are as follows:
Error CodeDescription
A0Err...Some error occurred.
A0ErrOkSuccessful completion.

See Also

a0WaitRequest() a0TestAnyRequest() a0ISend() a0IReceive() a0ISendBuffer() a0IReceiveBuffer()