File indexing completed on 2026-11-07 10:15:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef THREAD_SUPPORT_H
0014 #define THREAD_SUPPORT_H
0015
0016 #include "flint.h"
0017
0018 #ifdef __cplusplus
0019 extern "C" {
0020 #endif
0021
0022 #define FLINT_DEFAULT_THREAD_LIMIT 99999
0023
0024 slong flint_request_threads(thread_pool_handle ** handles, slong thread_limit);
0025
0026 void flint_give_back_threads(thread_pool_handle * handles, slong num_handles);
0027
0028 slong flint_get_num_available_threads(void);
0029
0030 #define FLINT_PARALLEL_UNIFORM 1
0031 #define FLINT_PARALLEL_STRIDED 2
0032 #define FLINT_PARALLEL_DYNAMIC 4
0033 #define FLINT_PARALLEL_BSPLIT_LEFT_INPLACE 8
0034 #define FLINT_PARALLEL_VERBOSE 512
0035
0036 typedef void (* do_func_t)(slong i, void * args);
0037
0038 void flint_parallel_do(do_func_t f, void * args, slong n, int thread_limit, int flags);
0039
0040 typedef void (* bsplit_merge_func_t)(void *, void *, void *, void *);
0041 typedef void (* bsplit_basecase_func_t)(void *, slong, slong, void *);
0042 typedef void (* bsplit_init_func_t)(void *, void *);
0043 typedef void (* bsplit_clear_func_t)(void *, void *);
0044
0045 void flint_parallel_binary_splitting(void * res, bsplit_basecase_func_t basecase, bsplit_merge_func_t merge,
0046 size_t sizeof_res, bsplit_init_func_t init, bsplit_clear_func_t clear, void * args, slong a, slong b, slong basecase_cutoff, int thread_limit, int flags);
0047
0048 #ifdef __cplusplus
0049 }
0050 #endif
0051
0052 #endif