Skip to content
Browse files

delete unneeded boost headers

  • Loading branch information...
1 parent 82e478d commit 050f3016b2e938e128e7a169442495731fc6f387 @argv0 argv0 committed Aug 31, 2011
View
159 c_src/boost/boost/detail/interlocked.hpp
@@ -1,159 +0,0 @@
-#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
-#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/detail/interlocked.hpp
-//
-// Copyright 2005 Peter Dimov
-//
-// 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)
-//
-
-#include <boost/config.hpp>
-
-#if defined( BOOST_USE_WINDOWS_H )
-
-# include <windows.h>
-
-# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
-# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
-# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
-# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
-
-#elif defined(_WIN32_WCE)
-
-// under Windows CE we still have old-style Interlocked* functions
-
-extern "C" long __cdecl InterlockedIncrement( long* );
-extern "C" long __cdecl InterlockedDecrement( long* );
-extern "C" long __cdecl InterlockedCompareExchange( long*, long, long );
-extern "C" long __cdecl InterlockedExchange( long*, long );
-extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
-
-# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
-# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
-# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
-# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
-
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
- ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare)))
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
- ((void*)BOOST_INTERLOCKED_EXCHANGE((long*)(dest),(long)(exchange)))
-
-#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
-
-#if defined( __CLRCALL_PURE_OR_CDECL )
-
-extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * );
-extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * );
-extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long );
-extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long );
-extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long );
-
-#else
-
-extern "C" long __cdecl _InterlockedIncrement( long volatile * );
-extern "C" long __cdecl _InterlockedDecrement( long volatile * );
-extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
-extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
-extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
-
-#endif
-
-# pragma intrinsic( _InterlockedIncrement )
-# pragma intrinsic( _InterlockedDecrement )
-# pragma intrinsic( _InterlockedCompareExchange )
-# pragma intrinsic( _InterlockedExchange )
-# pragma intrinsic( _InterlockedExchangeAdd )
-
-# if defined(_M_IA64) || defined(_M_AMD64)
-
-extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
-extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
-
-# pragma intrinsic( _InterlockedCompareExchangePointer )
-# pragma intrinsic( _InterlockedExchangePointer )
-
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
-
-# else
-
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
- ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
- ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
-
-# endif
-
-# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
-# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
-# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
-# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
-
-#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
-
-#if defined(__MINGW64__)
-#define BOOST_INTERLOCKED_IMPORT
-#else
-#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
-#endif
-
-
-namespace boost
-{
-
-namespace detail
-{
-
-extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedIncrement( long volatile * );
-extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedDecrement( long volatile * );
-extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange( long volatile *, long, long );
-extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchange( long volatile *, long );
-extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd( long volatile *, long );
-
-# if defined(_M_IA64) || defined(_M_AMD64)
-extern "C"BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer( void* volatile *, void*, void* );
-extern "C"BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer( void* volatile *, void* );
-# endif
-
-} // namespace detail
-
-} // namespace boost
-
-# define BOOST_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement
-# define BOOST_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange
-# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
-# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
-
-# if defined(_M_IA64) || defined(_M_AMD64)
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::boost::detail::InterlockedCompareExchangePointer
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER ::boost::detail::InterlockedExchangePointer
-# else
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
- ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
- ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
-# endif
-
-#else
-
-# error "Interlocked intrinsics not available"
-
-#endif
-
-#endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
View
53 c_src/boost/boost/memory_order.hpp
@@ -1,53 +0,0 @@
-#ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED
-#define BOOST_MEMORY_ORDER_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-// boost/memory_order.hpp
-//
-// Defines enum boost::memory_order per the C++0x working draft
-//
-// Copyright (c) 2008, 2009 Peter Dimov
-//
-// 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)
-
-
-namespace boost
-{
-
-//
-// Enum values are chosen so that code that needs to insert
-// a trailing fence for acquire semantics can use a single
-// test such as:
-//
-// if( mo & memory_order_acquire ) { ...fence... }
-//
-// For leading fences one can use:
-//
-// if( mo & memory_order_release ) { ...fence... }
-//
-// Architectures such as Alpha that need a fence on consume
-// can use:
-//
-// if( mo & ( memory_order_acquire | memory_order_consume ) ) { ...fence... }
-//
-
-enum memory_order
-{
- memory_order_relaxed = 0,
- memory_order_acquire = 1,
- memory_order_release = 2,
- memory_order_acq_rel = 3, // acquire | release
- memory_order_seq_cst = 7, // acq_rel | 4
- memory_order_consume = 8
-};
-
-} // namespace boost
-
-#endif // #ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED
View
49 c_src/boost/boost/smart_ptr/detail/sp_has_sync.hpp
@@ -1,49 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/smart_ptr/detail/sp_has_sync.hpp
-//
-// Copyright (c) 2008, 2009 Peter Dimov
-//
-// 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)
-//
-// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics
-// are available.
-//
-
-#if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( BOOST_SP_NO_SYNC )
-
-#define BOOST_SP_HAS_SYNC
-
-#if defined( __arm__ ) || defined( __armel__ )
-#undef BOOST_SP_HAS_SYNC
-#endif
-
-#if defined( __hppa ) || defined( __hppa__ )
-#undef BOOST_SP_HAS_SYNC
-#endif
-
-#if defined( __m68k__ )
-#undef BOOST_SP_HAS_SYNC
-#endif
-
-#if defined( __sparc__ )
-#undef BOOST_SP_HAS_SYNC
-#endif
-
-#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1100 )
-#undef BOOST_SP_HAS_SYNC
-#endif
-
-#endif // __GNUC__ * 100 + __GNUC_MINOR__ >= 401
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED
View
56 c_src/boost/boost/smart_ptr/detail/spinlock.hpp
@@ -1,56 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/detail/spinlock.hpp
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-// struct spinlock
-// {
-// void lock();
-// bool try_lock();
-// void unlock();
-//
-// class scoped_lock;
-// };
-//
-// #define BOOST_DETAIL_SPINLOCK_INIT <unspecified>
-//
-
-#include <boost/config.hpp>
-#include <boost/smart_ptr/detail/sp_has_sync.hpp>
-
-#if defined( BOOST_SP_USE_PTHREADS )
-# include <boost/smart_ptr/detail/spinlock_pt.hpp>
-
-#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
-# include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp>
-
-#elif defined( BOOST_SP_HAS_SYNC )
-# include <boost/smart_ptr/detail/spinlock_sync.hpp>
-
-#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# include <boost/smart_ptr/detail/spinlock_w32.hpp>
-
-#elif defined(BOOST_HAS_PTHREADS)
-# include <boost/smart_ptr/detail/spinlock_pt.hpp>
-
-#elif !defined(BOOST_HAS_THREADS)
-# include <boost/smart_ptr/detail/spinlock_nt.hpp>
-
-#else
-# error Unrecognized threading platform
-#endif
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
View
85 c_src/boost/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
@@ -1,85 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
-
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-
-#include <boost/smart_ptr/detail/yield_k.hpp>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class spinlock
-{
-public:
-
- int v_;
-
-public:
-
- bool try_lock()
- {
- int r;
-
- __asm__ __volatile__(
- "swp %0, %1, [%2]":
- "=&r"( r ): // outputs
- "r"( 1 ), "r"( &v_ ): // inputs
- "memory", "cc" );
-
- return r == 0;
- }
-
- void lock()
- {
- for( unsigned k = 0; !try_lock(); ++k )
- {
- boost::detail::yield( k );
- }
- }
-
- void unlock()
- {
- __asm__ __volatile__( "" ::: "memory" );
- *const_cast< int volatile* >( &v_ ) = 0;
- }
-
-public:
-
- class scoped_lock
- {
- private:
-
- spinlock & sp_;
-
- scoped_lock( scoped_lock const & );
- scoped_lock & operator=( scoped_lock const & );
-
- public:
-
- explicit scoped_lock( spinlock & sp ): sp_( sp )
- {
- sp.lock();
- }
-
- ~scoped_lock()
- {
- sp_.unlock();
- }
- };
-};
-
-} // namespace detail
-} // namespace boost
-
-#define BOOST_DETAIL_SPINLOCK_INIT {0}
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
View
89 c_src/boost/boost/smart_ptr/detail/spinlock_nt.hpp
@@ -1,89 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-
-#include <boost/assert.hpp>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class spinlock
-{
-public:
-
- bool locked_;
-
-public:
-
- inline bool try_lock()
- {
- if( locked_ )
- {
- return false;
- }
- else
- {
- locked_ = true;
- return true;
- }
- }
-
- inline void lock()
- {
- BOOST_ASSERT( !locked_ );
- locked_ = true;
- }
-
- inline void unlock()
- {
- BOOST_ASSERT( locked_ );
- locked_ = false;
- }
-
-public:
-
- class scoped_lock
- {
- private:
-
- spinlock & sp_;
-
- scoped_lock( scoped_lock const & );
- scoped_lock & operator=( scoped_lock const & );
-
- public:
-
- explicit scoped_lock( spinlock & sp ): sp_( sp )
- {
- sp.lock();
- }
-
- ~scoped_lock()
- {
- sp_.unlock();
- }
- };
-};
-
-} // namespace detail
-} // namespace boost
-
-#define BOOST_DETAIL_SPINLOCK_INIT { false }
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
View
91 c_src/boost/boost/smart_ptr/detail/spinlock_pool.hpp
@@ -1,91 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/detail/spinlock_pool.hpp
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-// spinlock_pool<0> is reserved for atomic<>, when/if it arrives
-// spinlock_pool<1> is reserved for shared_ptr reference counts
-// spinlock_pool<2> is reserved for shared_ptr atomic access
-//
-
-#include <boost/config.hpp>
-#include <boost/smart_ptr/detail/spinlock.hpp>
-#include <cstddef>
-
-namespace boost
-{
-
-namespace detail
-{
-
-template< int I > class spinlock_pool
-{
-private:
-
- static spinlock pool_[ 41 ];
-
-public:
-
- static spinlock & spinlock_for( void const * pv )
- {
-#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
- std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41;
-#else
- std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41;
-#endif
- return pool_[ i ];
- }
-
- class scoped_lock
- {
- private:
-
- spinlock & sp_;
-
- scoped_lock( scoped_lock const & );
- scoped_lock & operator=( scoped_lock const & );
-
- public:
-
- explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) )
- {
- sp_.lock();
- }
-
- ~scoped_lock()
- {
- sp_.unlock();
- }
- };
-};
-
-template< int I > spinlock spinlock_pool< I >::pool_[ 41 ] =
-{
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
- BOOST_DETAIL_SPINLOCK_INIT
-};
-
-} // namespace detail
-} // namespace boost
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
View
79 c_src/boost/boost/smart_ptr/detail/spinlock_pt.hpp
@@ -1,79 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-
-#include <pthread.h>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class spinlock
-{
-public:
-
- pthread_mutex_t v_;
-
-public:
-
- bool try_lock()
- {
- return pthread_mutex_trylock( &v_ ) == 0;
- }
-
- void lock()
- {
- pthread_mutex_lock( &v_ );
- }
-
- void unlock()
- {
- pthread_mutex_unlock( &v_ );
- }
-
-public:
-
- class scoped_lock
- {
- private:
-
- spinlock & sp_;
-
- scoped_lock( scoped_lock const & );
- scoped_lock & operator=( scoped_lock const & );
-
- public:
-
- explicit scoped_lock( spinlock & sp ): sp_( sp )
- {
- sp.lock();
- }
-
- ~scoped_lock()
- {
- sp_.unlock();
- }
- };
-};
-
-} // namespace detail
-} // namespace boost
-
-#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER }
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED
View
87 c_src/boost/boost/smart_ptr/detail/spinlock_sync.hpp
@@ -1,87 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-
-#include <boost/smart_ptr/detail/yield_k.hpp>
-
-#if defined( __ia64__ ) && defined( __INTEL_COMPILER )
-# include <ia64intrin.h>
-#endif
-
-namespace boost
-{
-
-namespace detail
-{
-
-class spinlock
-{
-public:
-
- int v_;
-
-public:
-
- bool try_lock()
- {
- int r = __sync_lock_test_and_set( &v_, 1 );
- return r == 0;
- }
-
- void lock()
- {
- for( unsigned k = 0; !try_lock(); ++k )
- {
- boost::detail::yield( k );
- }
- }
-
- void unlock()
- {
- __sync_lock_release( &v_ );
- }
-
-public:
-
- class scoped_lock
- {
- private:
-
- spinlock & sp_;
-
- scoped_lock( scoped_lock const & );
- scoped_lock & operator=( scoped_lock const & );
-
- public:
-
- explicit scoped_lock( spinlock & sp ): sp_( sp )
- {
- sp.lock();
- }
-
- ~scoped_lock()
- {
- sp_.unlock();
- }
- };
-};
-
-} // namespace detail
-} // namespace boost
-
-#define BOOST_DETAIL_SPINLOCK_INIT {0}
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
View
113 c_src/boost/boost/smart_ptr/detail/spinlock_w32.hpp
@@ -1,113 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// 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)
-//
-
-#include <boost/detail/interlocked.hpp>
-#include <boost/smart_ptr/detail/yield_k.hpp>
-
-// BOOST_COMPILER_FENCE
-
-#if defined(__INTEL_COMPILER)
-
-#define BOOST_COMPILER_FENCE __memory_barrier();
-
-#elif defined( _MSC_VER ) && _MSC_VER >= 1310
-
-extern "C" void _ReadWriteBarrier();
-#pragma intrinsic( _ReadWriteBarrier )
-
-#define BOOST_COMPILER_FENCE _ReadWriteBarrier();
-
-#elif defined(__GNUC__)
-
-#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" );
-
-#else
-
-#define BOOST_COMPILER_FENCE
-
-#endif
-
-//
-
-namespace boost
-{
-
-namespace detail
-{
-
-class spinlock
-{
-public:
-
- long v_;
-
-public:
-
- bool try_lock()
- {
- long r = BOOST_INTERLOCKED_EXCHANGE( &v_, 1 );
-
- BOOST_COMPILER_FENCE
-
- return r == 0;
- }
-
- void lock()
- {
- for( unsigned k = 0; !try_lock(); ++k )
- {
- boost::detail::yield( k );
- }
- }
-
- void unlock()
- {
- BOOST_COMPILER_FENCE
- *const_cast< long volatile* >( &v_ ) = 0;
- }
-
-public:
-
- class scoped_lock
- {
- private:
-
- spinlock & sp_;
-
- scoped_lock( scoped_lock const & );
- scoped_lock & operator=( scoped_lock const & );
-
- public:
-
- explicit scoped_lock( spinlock & sp ): sp_( sp )
- {
- sp.lock();
- }
-
- ~scoped_lock()
- {
- sp_.unlock();
- }
- };
-};
-
-} // namespace detail
-} // namespace boost
-
-#define BOOST_DETAIL_SPINLOCK_INIT {0}
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED
View
149 c_src/boost/boost/smart_ptr/detail/yield_k.hpp
@@ -1,149 +0,0 @@
-#ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED
-#define BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// yield_k.hpp
-//
-// Copyright (c) 2008 Peter Dimov
-//
-// void yield( unsigned k );
-//
-// Typical use:
-//
-// for( unsigned k = 0; !try_lock(); ++k ) yield( k );
-//
-// 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
-//
-
-#include <boost/config.hpp>
-
-// BOOST_SMT_PAUSE
-
-#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) )
-
-extern "C" void _mm_pause();
-#pragma intrinsic( _mm_pause )
-
-#define BOOST_SMT_PAUSE _mm_pause();
-
-#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
-
-#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" );
-
-#endif
-
-//
-
-#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
-
-#if defined( BOOST_USE_WINDOWS_H )
-# include <windows.h>
-#endif
-
-namespace boost
-{
-
-namespace detail
-{
-
-#if !defined( BOOST_USE_WINDOWS_H )
- extern "C" void __stdcall Sleep( unsigned long ms );
-#endif
-
-inline void yield( unsigned k )
-{
- if( k < 4 )
- {
- }
-#if defined( BOOST_SMT_PAUSE )
- else if( k < 16 )
- {
- BOOST_SMT_PAUSE
- }
-#endif
- else if( k < 32 )
- {
- Sleep( 0 );
- }
- else
- {
- Sleep( 1 );
- }
-}
-
-} // namespace detail
-
-} // namespace boost
-
-#elif defined( BOOST_HAS_PTHREADS )
-
-#include <sched.h>
-#include <time.h>
-
-namespace boost
-{
-
-namespace detail
-{
-
-inline void yield( unsigned k )
-{
- if( k < 4 )
- {
- }
-#if defined( BOOST_SMT_PAUSE )
- else if( k < 16 )
- {
- BOOST_SMT_PAUSE
- }
-#endif
- else if( k < 32 || k & 1 )
- {
- sched_yield();
- }
- else
- {
- // g++ -Wextra warns on {} or {0}
- struct timespec rqtp = { 0, 0 };
-
- // POSIX says that timespec has tv_sec and tv_nsec
- // But it doesn't guarantee order or placement
-
- rqtp.tv_sec = 0;
- rqtp.tv_nsec = 1000;
-
- nanosleep( &rqtp, 0 );
- }
-}
-
-} // namespace detail
-
-} // namespace boost
-
-#else
-
-namespace boost
-{
-
-namespace detail
-{
-
-inline void yield( unsigned )
-{
-}
-
-} // namespace detail
-
-} // namespace boost
-
-#endif
-
-#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED

0 comments on commit 050f301

Please sign in to comment.
Something went wrong with that request. Please try again.