Q_PUSH(3)

NAME
q_push - push a job onto a smolq queue

LIBRARY
Librecast library (liblibrecast, -llibrecast)

SYNOPSIS
#include <librecast/q.h>

int  q_push(q_t *q, void *(*f)(void *), void *restrict arg);
int  q_trypush(q_t *q, void *(*f)(void *), void *restrict arg);

Compile and link with -llibrecast.

DESCRIPTION
q_push() pushes f onto the queue q with argument arg.

q_trypush() is the same as q_push() except that if the queue writer 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

EAGAIN
    ( q_trypush()) The operation could not be performed without blocking. (i.e., the queue was full).

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_wait(3), sem_post(3), sem_wait(3)