1 #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
\r
2 #define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
\r
4 // MS compatible compilers support #pragma once
\r
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
\r
11 // Copyright (c) 2008 Peter Dimov
\r
13 // Distributed under the Boost Software License, Version 1.0.
\r
14 // See accompanying file LICENSE_1_0.txt or copy at
\r
15 // http://www.boost.org/LICENSE_1_0.txt)
\r
18 #include <boost/smart_ptr/detail/yield_k.hpp>
\r
20 #if defined( __ia64__ ) && defined( __INTEL_COMPILER )
\r
21 # include <ia64intrin.h>
\r
40 int r = __sync_lock_test_and_set( &v_, 1 );
\r
46 for( unsigned k = 0; !try_lock(); ++k )
\r
48 boost::detail::yield( k );
\r
54 __sync_lock_release( &v_ );
\r
65 scoped_lock( scoped_lock const & );
\r
66 scoped_lock & operator=( scoped_lock const & );
\r
70 explicit scoped_lock( spinlock & sp ): sp_( sp )
\r
82 } // namespace detail
\r
83 } // namespace boost
\r
85 #define BOOST_DETAIL_SPINLOCK_INIT {0}
\r
87 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
\r