cthreadcomm · Section 3
cchan_try_recv
NAME
cchan_try_recv - try to receive a message with no block
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadcomm.h> ccol_retval cchan_try_recv(cchan *ch, cmessage *target_buf);
DESCRIPTION
Takes a message from the queue that the channel picks for the calling thread, if one is there, and returns at once when that queue is empty.
PARAMETERS
ch Channel to receive from target_buf Buffer that gets the message
RETURN VALUE
ccol_success - A message was received. The caller must free
target_buf->data.
ccol_invalid_args - ch or target_buf is NULL
ccol_container_empty - The chosen queue is empty
NOTES
This call never blocks. The direction comes from the ID of the calling thread, as described in cchan_recv(3).