cthreadcomm · Section 3
cdynmq_recv
NAME
cdynmq_recv - receive a message from a dynamic queue (it blocks)
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadcomm.h> ccol_retval cdynmq_recv(cdynmq *dq, cmessage *target_buf);
DESCRIPTION
Waits until the dynamic queue holds a message, then removes the message at the head and hands it over in target_buf without copying the data. The data pointer then belongs to the caller, who must free target_buf->data when done with it.
PARAMETERS
dq Dynamic 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 - dq 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.