FLINT3.7.0-dev

thread_pool_set_size

Synopsis#include <flint/thread_pool.h>
int thread_pool_set_size(thread_pool_t T, slong new_size)source

If every thread of T is available, replaces them by new_size new threads (none if \mathit{new\_size} \le 0 or FLINT was built without pthreads) and returns 1. Otherwise changes nothing and returns 0.

All old threads are told to exit and joined, even if the size does not change, and new threads are created. Resizing therefore costs a thread creation per thread and should not be done in a loop.

Cite this page

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