FLINT3.7.0-dev

thread_pool_request

Synopsis#include <flint/thread_pool.h>
slong thread_pool_request(thread_pool_t T, thread_pool_handle * out, slong requested)source

Marks up to requested available threads as unavailable, writes their handles to out and returns how many were obtained, possibly 0. The threads must later be returned with thread_pool_give_back.

thread_pool_request scans the pool from the first thread under the pool mutex, so the call costs time linear in the pool size. Callers should not assume that they obtain as many threads as requested, since other threads may hold some of the pool. The request is not limited by the calling thread's worker budget (flint_get_num_threads() minus 1); for the global pool, flint_request_threads applies that limit.

Cite this page

The FLINT team, “thread_pool_request (thread_pool.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/thread_pool/thread_pool_request.html (generated 2026-10-20).