Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85860 - trunk/boost/sync/detail
From: andrey.semashev_at_[hidden]
Date: 2013-09-23 16:30:48


Author: andysem
Date: 2013-09-23 16:30:48 EDT (Mon, 23 Sep 2013)
New Revision: 85860
URL: http://svn.boost.org/trac/boost/changeset/85860

Log:
Minor code cleanup.

Text files modified:
   trunk/boost/sync/detail/atomic.hpp | 31 ++++++++++++++++++++++---------
   trunk/boost/sync/detail/pause.hpp | 22 ++++++++++++----------
   2 files changed, 34 insertions(+), 19 deletions(-)

Modified: trunk/boost/sync/detail/atomic.hpp
==============================================================================
--- trunk/boost/sync/detail/atomic.hpp Mon Sep 23 14:08:44 2013 (r85859)
+++ trunk/boost/sync/detail/atomic.hpp 2013-09-23 16:30:48 EDT (Mon, 23 Sep 2013) (r85860)
@@ -9,15 +9,7 @@
 #ifndef BOOST_SYNC_DETAIL_ATOMIC_HPP
 #define BOOST_SYNC_DETAIL_ATOMIC_HPP
 
-#ifdef BOOST_SYNC_USE_STD_ATOMIC
-#include <atomic>
-#else
-#include <boost/atomic.hpp>
-#endif
-
-namespace boost {
-namespace sync {
-namespace detail {
+#if !defined(BOOST_SYNC_USE_STD_ATOMIC)
 
 #if BOOST_CLANG
 #if __has_include( <atomic> )
@@ -35,6 +27,25 @@
 #endif
 #endif
 
+#endif // !defined(BOOST_SYNC_USE_STD_ATOMIC)
+
+#ifdef BOOST_SYNC_USE_STD_ATOMIC
+#include <atomic>
+#else
+#include <boost/atomic.hpp>
+#endif
+
+#include <boost/sync/detail/config.hpp>
+#include <boost/sync/detail/header.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+namespace sync {
+namespace detail {
+
 #ifdef BOOST_SYNC_USE_STD_ATOMIC
 
 using std::atomic;
@@ -73,4 +84,6 @@
 
 #undef BOOST_SYNC_USE_STD_ATOMIC
 
+#include <boost/sync/detail/footer.hpp>
+
 #endif // BOOST_SYNC_DETAIL_ATOMIC_HPP

Modified: trunk/boost/sync/detail/pause.hpp
==============================================================================
--- trunk/boost/sync/detail/pause.hpp Mon Sep 23 14:08:44 2013 (r85859)
+++ trunk/boost/sync/detail/pause.hpp 2013-09-23 16:30:48 EDT (Mon, 23 Sep 2013) (r85860)
@@ -10,35 +10,37 @@
 #ifndef BOOST_SYNC_DETAIL_PAUSE_HPP_INCLUDED_
 #define BOOST_SYNC_DETAIL_PAUSE_HPP_INCLUDED_
 
+#include <boost/sync/detail/config.hpp>
+#include <boost/sync/detail/header.hpp>
 
-#include <boost/config.hpp>
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
 
-#ifdef __SSE2__
-#include <xmmintrin.h>
+#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))
+extern "C" void _mm_pause(void);
+#pragma intrinsic(_mm_pause)
 #endif
 
 namespace boost {
 namespace sync {
 namespace detail {
 
-static BOOST_FORCEINLINE void pause()
+BOOST_FORCEINLINE void pause() BOOST_NOEXCEPT
 {
-#ifdef __SSE2__
+#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))
     _mm_pause();
 
 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
     __asm__ __volatile__("pause;");
 
-#elif (defined(__INTEL_COMPILER) || defined(_M_IX86))
- __asm { nop };
-
 #endif
 }
 
-
-
 } // namespace detail
 } // namespace sync
 } // namespace boost
 
+#include <boost/sync/detail/footer.hpp>
+
 #endif // BOOST_SYNC_DETAIL_PAUSE_HPP_INCLUDED_


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk