nthm_busy - inquire as to whether a thread has finished running
#include <nthm/nthm.h>
int nthm_busy ( nthm_pipe source , int *err )
The nthm_busy function polls the given pipe source to ascertain whether a successful call to nthm_read on source would return immediately to the caller with a completed result or would block because the source thread has not finished computing one.
If nthm_busy succeeds, then it returns non-zero for threads that are still running and zero for threads that are finished running.
If it does not succeed, then it returns zero.
The caller can disambiguate a return value of zero by the code assigned to the *err parameter.
Error codes are reported in the *err parameter, with any non-zero value indicating an error.
NTHM_NULPIP
The source parameter is a NULL pointer.
NTHM_INVPIP
The source parameter is not a NULL pointer but points to an invalid or corrupted pipe, or points nowhere in particular but fortunately did not cause a segfault.
nthm, nthm_open, nthm_send, nthm_select, nthm_truncate, nthm_truncate_all, nthm_truncated, nthm_enter_scope, nthm_exit_scope, nthm_kill, nthm_kill_all, nthm_killed, nthm_untether, nthm_tether, nthm_blocked, nthm_strerror, pthreads (7), nthm_sync
Dennis Furey (milonga@delayinsensitive.com)
https://github.com/gueststar/nthm