C Collections

cthreadcomm · Section 3

ccircq_recv

ccircq_recv - receive a message (it blocks)

C Collections (libccollections, -lccollections)

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

Waits until a message is in the queue and hands it over in
target_buf, without copying the data. The data then belongs to the
caller, who must free target_buf->data when done with it.

cq          Circular queue to receive from
target_buf  Buffer that gets the message together with the ownership
            of the data.

ccol_success        - A message was received. The caller must free
                      target_buf->data.
ccol_invalid_args   - cq or target_buf is NULL

The wait has no time limit. Turning sends off doesn't wake a waiting
receiver: It stays blocked until sends are turned on again and a
message arrives. The function is thread-safe.

ccircq_try_recv(3), ccircq_timed_recv(3), ccircq_send(3)