Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85844 - trunk/boost/sync/detail
From: tim_at_[hidden]
Date: 2013-09-23 03:41:08


Author: timblechmann
Date: 2013-09-23 03:41:08 EDT (Mon, 23 Sep 2013)
New Revision: 85844
URL: http://svn.boost.org/trac/boost/changeset/85844

Log:
sync: provide pause instruction via detail::pause()

Added:
   trunk/boost/sync/detail/pause.hpp (contents, props changed)

Added: trunk/boost/sync/detail/pause.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/sync/detail/pause.hpp 2013-09-23 03:41:08 EDT (Mon, 23 Sep 2013) (r85844)
@@ -0,0 +1,44 @@
+/*
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * (C) Copyright 2013 Tim Blechmann
+ * (C) Copyright 2013 Andrey Semashev
+ */
+
+#ifndef BOOST_SYNC_DETAIL_PAUSE_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_PAUSE_HPP_INCLUDED_
+
+
+#include <boost/config.hpp>
+
+#ifdef __SSE2__
+#include <xmmintrin.h>
+#endif
+
+namespace boost {
+namespace sync {
+namespace detail {
+
+static BOOST_FORCEINLINE void pause()
+{
+#ifdef __SSE2__
+ _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
+
+#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