Boost logo

Boost-Commit :

From: pbristow_at_[hidden]
Date: 2007-06-22 08:47:52

Author: pbristow
Date: 2007-06-22 08:47:51 EDT (Fri, 22 Jun 2007)
New Revision: 7126

Added thread safety info

Text files modified:
   sandbox/math_toolkit/libs/math/doc/implementation.qbk | 18 ++++++++++++++++++
   1 files changed, 18 insertions(+), 0 deletions(-)

Modified: sandbox/math_toolkit/libs/math/doc/implementation.qbk
--- sandbox/math_toolkit/libs/math/doc/implementation.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/implementation.qbk 2007-06-22 08:47:51 EDT (Fri, 22 Jun 2007)
@@ -265,6 +265,24 @@
   double p = boost::math::constants::pi; // Context does not allow for disambiguation of overloaded function
   double p = boost::math::constants::pi(); // Context does not allow for disambiguation of overloaded function
+[h4 Thread safety]
+Reporting of error by setting errno should be thread safe already
+(otherwise none of the std lib math functions would be thread safe?).
+If you turn on reporting of errors via exceptions, errno gets left unused anyway.
+Other than that, the code is intended to be thread safe *for built in
+real-number types* : so float, double and long double are all thread safe.
+For non-built-in types - NTL::RR for example - initialisation of the various
+constants used in the implementation is potentially *not* thread safe.
+This most undesiable, but it would be a signficant challenge to fix it.
+Some compilers may offer the option of having
+static-constants initialised in a thread safe manner (Commeau, and maybe
+others?), if that's the case then the problem is solved. This is a topic of
+hot debate for the next C++ std revision, so hopefully all compilers
+will be required to do the right thing here at some point.
 [h4 Sources of Test Data]
 We found a large number of sources of test data.

Boost-Commit list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at