FLINT3.7.0-dev

flint_set_num_threads

Synopsis#include <flint/thread_support.h>
void flint_set_num_threads(int num_threads)source

Allows FLINT to use up to num_threads threads, resizing the global thread pool to num_threads - 1 workers. Must be called from the master thread, outside any parallel region. Throws an exception if threads of the pool are in use.

The first call creates global_thread_pool. Later calls resize it, which joins all existing worker threads and creates new ones, even if the size is unchanged. Without pthreads the value is ignored and FLINT uses one thread.

Guides#

Cite this page

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