Scroll to navigation

Q_WAIT(3) Librecast Programmer's Manual Q_WAIT(3)

NAME

q_wait - return the next job from the queue, when available

LIBRARY

Librecast library (liblibrecast, -llibrecast)

SYNOPSIS

#include <librecast/q.h>
int q_wait(q_t *q, q_job_t *job);
int q_trywait(q_t *q, q_job_t *job);

Compile and link with -llibrecast.

DESCRIPTION

q_wait() atomically fetches the next job in q and sets the job pointer to it. The call blocks until a job is available.

q_trywait() is the same as q_wait() except that if the queue read lock cannot be immediately obtained, then the call returns an error (errno set to EAGAIN) instead of blocking.

RETURN VALUE

The q_push() function returns zero on success. On error, -1 is returned and errno is set to indicate the error.

ERRORS

The function can also fail with the errors for sem_post(3) or sem_wait(3).

SEE ALSO

q_job_seek(3), q_pool_create(3), q_pool_destroy(3), q_init(3), q_free(3), q_push(3), sem_post(3), sem_wait(3)

2023-07-25 LIBRECAST