C Collections

cthreadcomm · Section 3

cdynmq_create

cdynmq_create - create a dynamic queue with no size limit

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadcomm.h>
 
cdynmq_create(err_str);

Creates a queue with no size limit, kept in a linked list. A send
never blocks, and the queue can grow without limit. Memory comes from
the standard malloc and free.
 
It is the same as calling cdynmq_create_mp() with NULL
memory management procedures.

err_str  Optional pointer that gets an error string on failure

A pointer to the new dynamic queue, or NULL on failure.

All operations on this queue are thread-safe. When you are done with
the queue, destroy it with cdynmq_destroy().
 
fork(2) and this queue can be combined in two supported ways: Call
fork(2) before you create the queue, or create it and then call fork(2)
followed at once by exec(3). A program that keeps running with no
exec(3) after the fork while a queue from before the fork is live is
not supported. As a defense in depth beyond that rule, the child never
inherits a lock that another thread held, in the locked state, at the
instant of the fork. The queue owns no thread of its own either, so a
queue that a child inherits this way stays fully usable.

cdynmq_create_mp(3), cdynmq_destroy(3)