next up previous contents index
Next: 25.5.3 oskit_ipc_wait: Receive a Up: 25.5 InterThread Communication Previous: 25.5.1 oskit_ipc_send: Send a

25.5.2 oskit_ipc_recv: Receive a message from a specific thread

 

SYNOPSIS

#include <oskit/threads/pthread.h>
#include <oskit/threads/ipc.h>

oskit_error_t oskit_ipc_recv(pthread_t src, void *msg, oskit_size_t msg_size, oskit_size_t *actual, oskit_s32_t timeout);

DESCRIPTION

Receive a message from another thread. The sending thread is specified by its pthread_t. If the specified sending thread has not attempted to send a message to current thread, the thread is blocked until such time as the sender initiates a send operation to the current thread. However, if the sender is blocked trying to send a message to the current thread, the message is immediately received and the sender is woken up.

The timeout value is either zero or non-zero. A zero value means do not wait, but simply check to see if a message from the sender is pending. A non-zero value means wait forever.

PARAMETERS

src
The pthread_t of the sending thread.
msg
The message buffer.
msg_size
The size of the message buffer, in bytes.
actual
The location in which to place the number of bytes received.
timeout
A timeout value. Currently only zero and non-zero values are legal. zero means no wait, non-zero means wait forever.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.



Utah Flux Research Group