C Collections

cthreadcomm · Section 3

ccircq_try_recv

ccircq_try_recv - try to receive a message with no block

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadcomm.h>
 
ccol_retval ccircq_try_recv(ccircq *cq,
                              cmessage *target_buf);

Takes a message from the queue if one is there, and returns
ccol_container_empty at once when the queue is empty. The data is
handed over without a copy.

cq          Circular queue 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    - cq or target_buf is NULL
ccol_container_empty - The queue is empty

This call never blocks. After a successful call the data belongs to
the caller, who must free target_buf->data.

ccircq_recv(3), ccircq_timed_recv(3)