cthreadpool · Section 3
cthrpool_future_fulfill
NAME
cthrpool_future_fulfill - deliver a result to a detached future
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadpool.h> ccol_retval cthrpool_future_fulfill(cthrpool_future *f, void *result);
DESCRIPTION
Delivers result to a future made by cthrpool_future_create_detached, wakes every caller blocked in cthrpool_future_get, and then releases the producer's reference. The call frees the future when that is the last reference left, which happens when the caller has already released its own with cthrpool_future_free and no cthrpool_future_get call is in progress. Call it exactly once for each detached future. Don't call it on a future that cthrpool_submit_future, cthrpool_try_submit_future or cthrpool_timed_submit_future returned: The worker thread that runs the task of such a future fulfills it inside the library.
PARAMETERS
f Future handle. cthrpool_future_create_detached must have made
it, and nothing must have fulfilled it yet
result Result value to deliver. cthrpool_future_get reads it back
RETURN VALUE
ccol_success result was delivered ccol_invalid_args f is NULL ccol_not_permitted f was already fulfilled
SEE ALSO
cthrpool_future_create_detached(3), cthrpool_future_get(3), cthrpool_future_done(3), cthrpool_future_free(3)