multiprecision thread safety
Hi Boost, I have a couple of questions regarding thread safety and Boost.Multiprecision. I am writing a library, and would like to be able to use mpfr_float (packed into my own complex class) in differing variable precisions on multiple threads simultaneously. 1. Is this supported? I looked in documentation, but didn't find comments to that end. 2. Must I manually call mpfr_free_cache when terminating threads, as recommended by the mpfr documentation? see http://www.mpfr.org/mpfr-current/mpfr.html, section 4.7 memory handling. If so, since Boost.Multiprecision claims to not change the default precision of mpfr_t, do I need to access the particular back end for the thread, and free its cache? Thanks, Daniel Brake danielthebrake@gmail.com
On 14/01/2016 17:56, Daniel Brake wrote:
Hi Boost, I have a couple of questions regarding thread safety and Boost.Multiprecision. I am writing a library, and would like to be able to use mpfr_float (packed into my own complex class) in differing variable precisions on multiple threads simultaneously.
1. Is this supported? I looked in documentation, but didn't find comments to that end.
The boost wrappers don't add anything new that would be thread unsafe, so yes, within whatever limitations mpfr has.
1. Must I manually call mpfr_free_cache when terminating threads, as recommended by the mpfr documentation? see http://www.mpfr.org/mpfr-current/mpfr.html, section 4.7 memory handling. If so, since Boost.Multiprecision claims to not change the default precision of mpfr_t, do I need to access the particular back end for the thread, and free its cache?
Yes. Boost.Multiprecision can't know when your thread exits, so you have to do any thread-specific mpfr cleanup yourself. HTH, John.
participants (2)
-
Daniel Brake
-
John Maddock