id summary reporter owner description type status milestone component version severity resolution keywords cc 5752 boost::call_once() is unreliable on some platforms Matthew Dempsky viboes "boost::call_once() is an implementation of Mike Burrows's fast_pthread_once() algorithm, as described in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm. In the correctness proof, there is a requirement that loads and stores of the epoch value are atomic (i.e., do not exhibit word tearing). In Mike's example implementation, the sig_atomic_t type is used, which is required by the C standard to support atomic loads and stores. However, in the boost::call_once() implementation, the epoch value is defined as uintmax_t, which has no such guarantee, and in practice is not atomic on some architectures. E.g., on OpenBSD/i386, uintmax_t is a 64-bit type and assignments to a 64-bit memory address must be split into two (non-atomic) store instructions. Therefore, thread/pthread/once.hpp should be changed to use a type that is guaranteed to support atomic loads and stores instead of uintmax_t. Additionally, since once_flag::epoch is accessed by multiple threads without any synchronization, it should be marked volatile. (Alternatively, the new C++0x atomic operations library appears suitable for this use as well.)" Bugs closed Boost 1.54.0 thread Boost 1.47.0 Problem fixed once viboes fmhess@…