cthreadcomm · Section 3
ccircq_recv
NAME
ccircq_recv - receive a message (it blocks)
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadcomm.h> ccol_retval ccircq_recv(ccircq *cq, cmessage *target_buf);
DESCRIPTION
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.
PARAMETERS
cq Circular queue to receive from
target_buf Buffer that gets the message together with the ownership
of the data.
RETURN VALUE
ccol_success - A message was received. The caller must free
target_buf->data.
ccol_invalid_args - cq or target_buf is NULL
NOTES
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.