reusing mpz_t and threads
Ian Zimmerman
itz at buug.org
Fri Oct 14 00:33:27 CEST 2005
Hi, I'd like to use gmp to do infinite precision arithmetic in a
functional language. I also like the suggestion to keep some kind of
freelist to avoid allocating and initializing new mpzs all the time.
But, I don't know what to do about thread safety. The freelist must be
a global and is modified each time I create a new value, which is with
every expression in a functional language. I am afraid if I have to
lock a mutex this often it will hurt performance worse than the
individual allocations would.
Is there a tested solution to this dilemma?
TIA
--
"It's not true or not." A reality show producer (real quote)
More information about the gmp-discuss
mailing list