C Collections

cthreadpool · Section 3

cthrpool_declare

cthrpool_declare - declare an uninitialised thread pool variable

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadpool.h>
 
cthrpool_declare(name);

Expands to `cthrpool name` and leaves the variable uninitialized, so you
must assign it with cthrpool_create() or cthrpool_create_mp() before you
use it.
 
The macro is there so that the naming matches the other c_collections
modules.

name  Variable name to declare.

cthrpool_declare(pool);
char *err = NULL;
pool = cthrpool_create(4, 128, &err);
if (!pool) { fprintf(stderr, "%s\n", err); exit(1); }
/* ... submit tasks ... */
cthrpool_shutdown_drain(pool);
cthrpool_destroy(pool);

cthrpool_declare_scoped(3), cthrpool_construct(3), cthrpool_create(3)