spe_in_mbox_write

NAME

spe_in_mbox_write - Write up to count messages to the SPE inbound mailbox.

SYNOPSIS

#include <libspe2.h>

int spe_in_mbox_write (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 containing the 32-bit mailbox messages to be written by the call.
count The maximum number of mailbox entries to be written by this call.
behavior Specifies whether the call should block until mailbox messages are written.

DESCRIPTION

Write up to count messages to the SPE inbound mailbox for the SPE context spe. This call may be blocking or non-blocking, depending on behavior.

The blocking version of this call is useful to send a sequence of mailbox messages to an SPE program, which do not require further synchronization. The non-blocking version is advantageous when SPE events are used for synchronization in multi-threaded applications.

spe_in_mbox_status can be called to ensure that data can be written before writing the SPU inbound mailbox.

RETURN VALUE

>0 the number of 32-bit mailbox messages written

0 (zero) no mailbox message could be written

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 written.
SPE_MBOX_ANY_BLOCKING The call blocks until at least one mailbox message has been written.
SPE_MBOX_ANY_NONBLOCKING The call writes as many mailbox messages as possible up to a maximum of count without blocking.

SEE ALSO

spe_in_mbox_status(3)