Boost Users :
Subject: Re: [Boost-users] multiprecision thread safety
From: John Maddock (jz.maddock_at_[hidden])
Date: 2016-01-14 14:27:04
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net