q_search - search for an entry in a smolq queue
Contents
Description
q_search() searches the queue q to find an entry that matches both f and arg.
No locks, so readers may read while we're searching, and writers may write. If something is read while
we search, we will still return a positive match for that item, even though it is no longer in the queue.
If a writer writes we will not notice that write. If this is a problem, for a particular use-case, an
external lock will be required.
Errors
The function can fail with any of the errors for sem_getvalue(3).
Library
Librecast library (liblibrecast, -llibrecast)
Name
q_search - search for an entry in a smolq queue
Return Value
The q_push() function returns 1 if found, zero if not found. On error, -1 is returned and errno is set to
indicate the error.
See Also
q_job_seek(3), q_pool_create(3), q_pool_destroy(3), q_init(3), q_free(3), q_push(3), q_wait(3), sem_getvalue(3). LIBRECAST 2023-07-27 Q_SEARCH(3)
Synopsis
#include<librecast/q.h>intq_search(q_t*q,void*(*f)(void*),void*restrictarg);
Compile and link with -llibrecast.
