Subject: [Boost-bugs] [Boost C++ Libraries] #6782: call_once uses incorrect barrier intrinsic on Visual Studio
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-04-11 16:56:27
#6782: call_once uses incorrect barrier intrinsic on Visual Studio
------------------------------------+---------------------------------------
Reporter: ybungalobill@⦠| Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.49.0 | Severity: Problem
Keywords: |
------------------------------------+---------------------------------------
boost\thread\win32\interlocked_read.hpp uses _ReadWriteBarrier() as a
barrier. However, [http://msdn.microsoft.com/en-
us/library/f20w0x5e%28v=vs.100%29.aspx according to MSDN] and the machine
code generated, it doesn't emit any memory barrier instructions at all:
> The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier compiler
intrinsics prevent only compiler re-ordering. To prevent the CPU from re-
ordering read and write operations, use the MemoryBarrier macro.
So one should use the MemoryBarrier() macro instead. In fact according
[http://msdn.microsoft.com/en-
us/library/windows/desktop/ms684208%28v=vs.85%29.aspx this page]
_ReadWriteBarrier is not necessary for volatile variables access since
VS2005.
Thanks,
Y. Galka.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6782> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC