q_wait(3)

q_wait3

Return the next job from the queue, when available

Usage

#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.

Library

Librecast library (liblibrecast, -llibrecast)

Overview

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).

From liblibrecast-dev 0.9.1-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.