The GMP code is reentrant and thread-safe, with some exceptions:
mpf_set_default_prec
saves the selected precision in
a global variable.
mp_set_memory_functions
uses several global
variables for storing the selected memory allocation functions.
mp_set_memory_functions
(or malloc
and friends by default) are
not reentrant, GMP will not be reentrant either.
mpz_random
, etc) use a random number
generator from the C library, usually mrand48
or random
. These
routines are not reentrant, since they rely on global state.
(However the newer random number functions that accept a
gmp_randstate_t
parameter are reentrant.)
alloca
is not available, or GMP is configured with
`--disable-alloca', the library is not reentrant, due to the current
implementation of `stack-alloc.c'. In the generated `config.h',
USE_STACK_ALLOC
set to 1 will mean not reentrant.
Go to the first, previous, next, last section, table of contents.