---
name: "q_job_seek"
section: "3"
platform: "linux"
package: "liblibrecast-dev"
version: "0.9.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/q_job_seek"
---

# q\_job\_seek(3)

wait for and execute jobs from a smolq queue

## NAME

q\_job\_seek - wait for and execute jobs from a smolq queue

## LIBRARY

Librecast library (*liblibrecast*, *-llibrecast*)

## SYNOPSIS

```
#include <librecast/q.h>
```

**void \*q\_job\_seek(void** *\*arg***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

The **q\_job\_seek**() function atomically fetches the next *job* in *q* and executes it before looping and repeating. This is intended to be used as the start\_routine for [**pthread\_create**(3)](/pthread_create/3.md) or used as the function *f* when calling [**q\_pool\_create**(3)](/q_pool_create/3.md).

The function loops indefinitely until the thread is cancelled with [**pthread\_cancel**(3)](/pthread_cancel/3.md) or [**q\_pool\_destroy**(3)](/q_pool_destroy/3.md).

## RETURN VALUE

The **q\_job\_seek**() function returns the same pointer *arg* that was passed to it.

## ERRORS

None.

## SEE ALSO

[**q\_pool\_create**(3)](/q_pool_create/3.md), [**q\_pool\_destroy**(3)](/q_pool_destroy/3.md), [**q\_init**(3)](/q_init/3.md), [**q\_free**(3)](/q_free/3.md), [**q\_push**(3)](/q_push/3.md), [**q\_wait**(3)](/q_wait/3.md), [**sem\_wait**(3)](/sem_wait/3.md), [**pthread\_cancel**(3)](/pthread_cancel/3.md), [**pthread\_create**(3)](/pthread_create/3.md)
