C Collections

cthreadcomm · Section 3

cchan_try_recv

cchan_try_recv - try to receive a message with no block

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadcomm.h>
 
ccol_retval cchan_try_recv(cchan *ch, cmessage *target_buf);

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.

ch          Channel to receive from
target_buf  Buffer that gets the message

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

This call never blocks. The direction comes from the ID of the
calling thread, as described in cchan_recv(3).

cchan_recv(3), cchan_timed_recv(3)