spe_out_intr_mbox_read

NAME

spe_out_intr_mbox_read - Read up to count messages from the SPE outbound interrupting mailbox.

SYNOPSIS

#include <libspe2.h>

int spe_out_intr_mbox_read (spe_context_ptr_t spe, unsigned int *mbox_data, int count, unsigned int behavior)

Parameters  
spe Specifies the SPE context of the SPU inbound mailbox to be written.
mbox_data A pointer to an array of count unsigned integers holding the 32-bit mailbox messages to be written by the call.
count The maximum number of mailbox entries to be read by this call.
behavior Specifies whether the call should block until completion.

DESCRIPTION

This function reads up to count messages from the SPE outbound interrupting mailbox for the SPE context spe. This call may be blocking or non-blocking, depending on behavior.

The blocking version of this call is particularly useful to receive a sequence of mailbox messages from an SPE program without further need for synchronization. The non-blocking version may be advantageous when using SPE events for synchronization in a multi-threaded application.

spe_out_intr_mbox_status can be called to ensure that data can be written prior to writing the SPU outbound interrupting mailbox.

RETURN VALUE

>0 the number of 32-bit mailbox messages read

0 (zero) no mailbox message could be read

EXIT STATUS

On error, -1 is returned and errno is set to indicate the error.

Possible errors include:

ESRCH The specified SPE context is invalid.
EIO The I/O error occurred.
EINVAL The specified pointer to the mailbox message, the specified maximum number of mailbox entries or the specified behavior is invalid.

OPTIONS

Possible values for behavior are:

Value Description
SPE_MBOX_ALL_BLOCKING The call blocks until all count mailbox messages have been read.
SPE_MBOX_ANY_BLOCKING The call blocks until at least one mailbox message has been read.
SPE_MBOX_ANY_NONBLOCKING The call reads as many mailbox messages as possible up to a maximum of count without blocking.

SEE ALSO

spe_out_intr_mbox_status(3)