From 8e761289a2446367267c6c0d9a26e734f0f78306 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 Dec 2020 20:29:05 +0300 Subject: Get rid of legacy build systems and rename cutl/ to libcutl/ --- cutl/details/boost/smart_ptr/bad_weak_ptr.hpp | 59 -- .../boost/smart_ptr/detail/atomic_count.hpp | 119 --- .../boost/smart_ptr/detail/atomic_count_gcc.hpp | 72 -- .../smart_ptr/detail/atomic_count_gcc_x86.hpp | 77 -- .../smart_ptr/detail/atomic_count_pthreads.hpp | 96 -- .../boost/smart_ptr/detail/atomic_count_sync.hpp | 61 -- .../boost/smart_ptr/detail/atomic_count_win32.hpp | 63 -- .../boost/smart_ptr/detail/lightweight_mutex.hpp | 42 - cutl/details/boost/smart_ptr/detail/lwm_nop.hpp | 37 - .../boost/smart_ptr/detail/lwm_pthreads.hpp | 87 -- .../boost/smart_ptr/detail/lwm_win32_cs.hpp | 108 -- .../boost/smart_ptr/detail/operator_bool.hpp | 63 -- .../boost/smart_ptr/detail/quick_allocator.hpp | 199 ---- .../boost/smart_ptr/detail/shared_count.hpp | 603 ------------ .../boost/smart_ptr/detail/shared_ptr_nmt.hpp | 182 ---- .../boost/smart_ptr/detail/sp_convertible.hpp | 91 -- .../boost/smart_ptr/detail/sp_counted_base.hpp | 79 -- .../smart_ptr/detail/sp_counted_base_acc_ia64.hpp | 151 --- .../boost/smart_ptr/detail/sp_counted_base_aix.hpp | 143 --- .../smart_ptr/detail/sp_counted_base_cw_ppc.hpp | 171 ---- .../smart_ptr/detail/sp_counted_base_gcc_ia64.hpp | 158 --- .../smart_ptr/detail/sp_counted_base_gcc_mips.hpp | 182 ---- .../smart_ptr/detail/sp_counted_base_gcc_ppc.hpp | 182 ---- .../smart_ptr/detail/sp_counted_base_gcc_sparc.hpp | 167 ---- .../smart_ptr/detail/sp_counted_base_gcc_x86.hpp | 174 ---- .../boost/smart_ptr/detail/sp_counted_base_nt.hpp | 108 -- .../boost/smart_ptr/detail/sp_counted_base_pt.hpp | 136 --- .../smart_ptr/detail/sp_counted_base_snc_ps3.hpp | 162 --- .../smart_ptr/detail/sp_counted_base_spin.hpp | 132 --- .../smart_ptr/detail/sp_counted_base_sync.hpp | 156 --- .../smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp | 151 --- .../boost/smart_ptr/detail/sp_counted_base_w32.hpp | 131 --- .../boost/smart_ptr/detail/sp_counted_impl.hpp | 254 ----- .../details/boost/smart_ptr/detail/sp_has_sync.hpp | 69 -- .../boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 - cutl/details/boost/smart_ptr/detail/spinlock.hpp | 56 -- .../boost/smart_ptr/detail/spinlock_gcc_arm.hpp | 120 --- .../details/boost/smart_ptr/detail/spinlock_nt.hpp | 89 -- .../boost/smart_ptr/detail/spinlock_pool.hpp | 91 -- .../details/boost/smart_ptr/detail/spinlock_pt.hpp | 79 -- .../boost/smart_ptr/detail/spinlock_sync.hpp | 87 -- .../boost/smart_ptr/detail/spinlock_w32.hpp | 113 --- cutl/details/boost/smart_ptr/detail/yield_k.hpp | 149 --- cutl/details/boost/smart_ptr/scoped_array.hpp | 132 --- cutl/details/boost/smart_ptr/scoped_ptr.hpp | 157 --- cutl/details/boost/smart_ptr/shared_ptr.hpp | 1035 -------------------- 46 files changed, 6818 deletions(-) delete mode 100644 cutl/details/boost/smart_ptr/bad_weak_ptr.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/atomic_count.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/atomic_count_gcc.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/atomic_count_pthreads.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/atomic_count_sync.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/atomic_count_win32.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/lightweight_mutex.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/lwm_nop.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/lwm_pthreads.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/lwm_win32_cs.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/operator_bool.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/quick_allocator.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/shared_count.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/shared_ptr_nmt.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_convertible.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock_nt.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock_pt.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock_sync.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/spinlock_w32.hpp delete mode 100644 cutl/details/boost/smart_ptr/detail/yield_k.hpp delete mode 100644 cutl/details/boost/smart_ptr/scoped_array.hpp delete mode 100644 cutl/details/boost/smart_ptr/scoped_ptr.hpp delete mode 100644 cutl/details/boost/smart_ptr/shared_ptr.hpp (limited to 'cutl/details/boost/smart_ptr') diff --git a/cutl/details/boost/smart_ptr/bad_weak_ptr.hpp b/cutl/details/boost/smart_ptr/bad_weak_ptr.hpp deleted file mode 100644 index 7d4cdf5..0000000 --- a/cutl/details/boost/smart_ptr/bad_weak_ptr.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/bad_weak_ptr.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// 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 - -#ifdef __BORLANDC__ -# pragma warn -8026 // Functions with excep. spec. are not expanded inline -#endif - -namespace cutl_details_boost -{ - -// The standard library that comes with Borland C++ 5.5.1, 5.6.4 -// defines std::exception and its members as having C calling -// convention (-pc). When the definition of bad_weak_ptr -// is compiled with -ps, the compiler issues an error. -// Hence, the temporary #pragma option -pc below. - -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 -# pragma option push -pc -#endif - -class bad_weak_ptr: public std::exception -{ -public: - - virtual char const * what() const throw() - { - return "tr1::bad_weak_ptr"; - } -}; - -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 -# pragma option pop -#endif - -} // namespace cutl_details_boost - -#ifdef __BORLANDC__ -# pragma warn .8026 // Functions with excep. spec. are not expanded inline -#endif - -#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/atomic_count.hpp b/cutl/details/boost/smart_ptr/detail/atomic_count.hpp deleted file mode 100644 index f9de4a4..0000000 --- a/cutl/details/boost/smart_ptr/detail/atomic_count.hpp +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/atomic_count.hpp - thread/SMP safe reference counter -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// -// 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) -// -// typedef cutl_details_boost::detail::atomic_count; -// -// atomic_count a(n); -// -// (n is convertible to long) -// -// Effects: Constructs an atomic_count with an initial value of n -// -// a; -// -// Returns: (long) the current value of a -// -// ++a; -// -// Effects: Atomically increments the value of a -// Returns: (long) the new value of a -// -// --a; -// -// Effects: Atomically decrements the value of a -// Returns: (long) the new value of a -// -// Important note: when --a returns zero, it must act as a -// read memory barrier (RMB); i.e. the calling thread must -// have a synchronized view of the memory -// -// On Intel IA-32 (x86) memory is always synchronized, so this -// is not a problem. -// -// On many architectures the atomic instructions already act as -// a memory barrier. -// -// This property is necessary for proper reference counting, since -// a thread can update the contents of a shared object, then -// release its reference, and another thread may immediately -// release the last reference causing object destruction. -// -// The destructor needs to have a synchronized view of the -// object to perform proper cleanup. -// -// Original example by Alexander Terekhov: -// -// Given: -// -// - a mutable shared object OBJ; -// - two threads THREAD1 and THREAD2 each holding -// a private smart_ptr object pointing to that OBJ. -// -// t1: THREAD1 updates OBJ (thread-safe via some synchronization) -// and a few cycles later (after "unlock") destroys smart_ptr; -// -// t2: THREAD2 destroys smart_ptr WITHOUT doing any synchronization -// with respect to shared mutable object OBJ; OBJ destructors -// are called driven by smart_ptr interface... -// - -#include -#include - -#ifndef BOOST_HAS_THREADS - -namespace cutl_details_boost -{ - -namespace detail -{ - -typedef long atomic_count; - -} - -} - -#elif defined(BOOST_AC_USE_PTHREADS) -# include - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) -# include - -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# include - -#elif defined(BOOST_HAS_PTHREADS) - -# define BOOST_AC_USE_PTHREADS -# include - -#else - -// Use #define BOOST_DISABLE_THREADS to avoid the error -#error Unrecognized threading platform - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/atomic_count_gcc.hpp b/cutl/details/boost/smart_ptr/detail/atomic_count_gcc.hpp deleted file mode 100644 index 6ea6dc2..0000000 --- a/cutl/details/boost/smart_ptr/detail/atomic_count_gcc.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED - -// -// boost/detail/atomic_count_gcc.hpp -// -// atomic_count for GNU libstdc++ v3 -// -// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2002 Lars Gullik Bjønnes -// Copyright 2003-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) -// - -#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402 -# include -#else -# include -#endif - -namespace cutl_details_boost -{ - -namespace detail -{ - -#if defined(__GLIBCXX__) // g++ 3.4+ - -using __gnu_cxx::__atomic_add; -using __gnu_cxx::__exchange_and_add; - -#endif - -class atomic_count -{ -public: - - explicit atomic_count( long v ) : value_( v ) {} - - long operator++() - { - return __exchange_and_add( &value_, +1 ) + 1; - } - - long operator--() - { - return __exchange_and_add( &value_, -1 ) - 1; - } - - operator long() const - { - return __exchange_and_add( &value_, 0 ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable _Atomic_word value_; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp b/cutl/details/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp deleted file mode 100644 index 68a1388..0000000 --- a/cutl/details/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED - -// -// boost/detail/atomic_count_gcc_x86.hpp -// -// atomic_count for g++ on 486+/AMD64 -// -// Copyright 2007 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 cutl_details_boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ) : value_( static_cast< int >( v ) ) {} - - long operator++() - { - return atomic_exchange_and_add( &value_, +1 ) + 1; - } - - long operator--() - { - return atomic_exchange_and_add( &value_, -1 ) - 1; - } - - operator long() const - { - return atomic_exchange_and_add( &value_, 0 ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable int value_; - -private: - - static int atomic_exchange_and_add( int * pw, int dv ) - { - // int r = *pw; - // *pw += dv; - // return r; - - int r; - - __asm__ __volatile__ - ( - "lock\n\t" - "xadd %1, %0": - "+m"( *pw ), "=r"( r ): // outputs (%0, %1) - "1"( dv ): // inputs (%2 == %1) - "memory", "cc" // clobbers - ); - - return r; - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/atomic_count_pthreads.hpp b/cutl/details/boost/smart_ptr/detail/atomic_count_pthreads.hpp deleted file mode 100644 index 711494d..0000000 --- a/cutl/details/boost/smart_ptr/detail/atomic_count_pthreads.hpp +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED - -// -// boost/detail/atomic_count_pthreads.hpp -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// -// 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 - -// -// The generic pthread_mutex-based implementation sometimes leads to -// inefficiencies. Example: a class with two atomic_count members -// can get away with a single mutex. -// -// Users can detect this situation by checking BOOST_AC_USE_PTHREADS. -// - -namespace cutl_details_boost -{ - -namespace detail -{ - -class atomic_count -{ -private: - - class scoped_lock - { - public: - - scoped_lock(pthread_mutex_t & m): m_(m) - { - pthread_mutex_lock(&m_); - } - - ~scoped_lock() - { - pthread_mutex_unlock(&m_); - } - - private: - - pthread_mutex_t & m_; - }; - -public: - - explicit atomic_count(long v): value_(v) - { - pthread_mutex_init(&mutex_, 0); - } - - ~atomic_count() - { - pthread_mutex_destroy(&mutex_); - } - - long operator++() - { - scoped_lock lock(mutex_); - return ++value_; - } - - long operator--() - { - scoped_lock lock(mutex_); - return --value_; - } - - operator long() const - { - scoped_lock lock(mutex_); - return value_; - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable pthread_mutex_t mutex_; - long value_; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/atomic_count_sync.hpp b/cutl/details/boost/smart_ptr/detail/atomic_count_sync.hpp deleted file mode 100644 index 3be0447..0000000 --- a/cutl/details/boost/smart_ptr/detail/atomic_count_sync.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED - -// -// boost/detail/atomic_count_sync.hpp -// -// atomic_count for g++ 4.1+ -// -// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html -// -// Copyright 2007 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) -// - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace cutl_details_boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ) : value_( v ) {} - - long operator++() - { - return __sync_add_and_fetch( &value_, 1 ); - } - - long operator--() - { - return __sync_add_and_fetch( &value_, -1 ); - } - - operator long() const - { - return __sync_fetch_and_add( &value_, 0 ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable long value_; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/atomic_count_win32.hpp b/cutl/details/boost/smart_ptr/detail/atomic_count_win32.hpp deleted file mode 100644 index e3ec802..0000000 --- a/cutl/details/boost/smart_ptr/detail/atomic_count_win32.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/atomic_count_win32.hpp -// -// Copyright (c) 2001-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 - -namespace cutl_details_boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ): value_( v ) - { - } - - long operator++() - { - return BOOST_INTERLOCKED_INCREMENT( &value_ ); - } - - long operator--() - { - return BOOST_INTERLOCKED_DECREMENT( &value_ ); - } - - operator long() const - { - return static_cast( value_ ); - } - -private: - - atomic_count( atomic_count const & ); - atomic_count & operator=( atomic_count const & ); - - long value_; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/lightweight_mutex.hpp b/cutl/details/boost/smart_ptr/detail/lightweight_mutex.hpp deleted file mode 100644 index 48595b2..0000000 --- a/cutl/details/boost/smart_ptr/detail/lightweight_mutex.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lightweight_mutex.hpp - lightweight mutex -// -// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// 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) -// -// typedef cutl_details_boost::detail::lightweight_mutex; -// -// cutl_details_boost::detail::lightweight_mutex is a header-only implementation of -// a subset of the Mutex concept requirements: -// -// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex -// -// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. -// - -#include - -#if !defined(BOOST_HAS_THREADS) -# include -#elif defined(BOOST_HAS_PTHREADS) -# include -#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include -#else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/lwm_nop.hpp b/cutl/details/boost/smart_ptr/detail/lwm_nop.hpp deleted file mode 100644 index dd8c992..0000000 --- a/cutl/details/boost/smart_ptr/detail/lwm_nop.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_nop.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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 cutl_details_boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -public: - - typedef lightweight_mutex scoped_lock; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/lwm_pthreads.hpp b/cutl/details/boost/smart_ptr/detail/lwm_pthreads.hpp deleted file mode 100644 index c3509f5..0000000 --- a/cutl/details/boost/smart_ptr/detail/lwm_pthreads.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_pthreads.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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 -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -private: - - pthread_mutex_t m_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { - -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); -#else - BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); -#endif - } - - ~lightweight_mutex() - { - BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - pthread_mutex_t & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - scoped_lock(lightweight_mutex & m): m_(m.m_) - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - } - - ~scoped_lock() - { - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - }; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/lwm_win32_cs.hpp b/cutl/details/boost/smart_ptr/detail/lwm_win32_cs.hpp deleted file mode 100644 index 3e8eb59..0000000 --- a/cutl/details/boost/smart_ptr/detail/lwm_win32_cs.hpp +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_win32_cs.hpp -// -// Copyright (c) 2002, 2003 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) -// - -#ifdef BOOST_USE_WINDOWS_H -# include -#endif - -namespace cutl_details_boost -{ - -namespace detail -{ - -#ifndef BOOST_USE_WINDOWS_H - -struct critical_section -{ - struct critical_section_debug * DebugInfo; - long LockCount; - long RecursionCount; - void * OwningThread; - void * LockSemaphore; -#if defined(_WIN64) - unsigned __int64 SpinCount; -#else - unsigned long SpinCount; -#endif -}; - -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(critical_section *); -extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(critical_section *); -extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(critical_section *); -extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(critical_section *); - -#else - -typedef ::CRITICAL_SECTION critical_section; - -#endif // #ifndef BOOST_USE_WINDOWS_H - -class lightweight_mutex -{ -private: - - critical_section cs_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { - InitializeCriticalSection(&cs_); - } - - ~lightweight_mutex() - { - DeleteCriticalSection(&cs_); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - lightweight_mutex & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - explicit scoped_lock(lightweight_mutex & m): m_(m) - { - EnterCriticalSection(&m_.cs_); - } - - ~scoped_lock() - { - LeaveCriticalSection(&m_.cs_); - } - }; -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/operator_bool.hpp b/cutl/details/boost/smart_ptr/detail/operator_bool.hpp deleted file mode 100644 index 8ae1527..0000000 --- a/cutl/details/boost/smart_ptr/detail/operator_bool.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// This header intentionally has no include guards. -// -// Copyright (c) 2001-2009, 2012 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 - -#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR ) - - explicit operator bool () const BOOST_NOEXCEPT - { - return px != 0; - } - -#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) - - operator bool () const BOOST_NOEXCEPT - { - return px != 0; - } - -#elif defined( _MANAGED ) - - static void unspecified_bool( this_type*** ) - { - } - - typedef void (*unspecified_bool_type)( this_type*** ); - - operator unspecified_bool_type() const BOOST_NOEXCEPT - { - return px == 0? 0: unspecified_bool; - } - -#elif \ - ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ - ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ - ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) - - typedef element_type * (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const BOOST_NOEXCEPT - { - return px == 0? 0: &this_type::get; - } - -#else - - typedef element_type * this_type::*unspecified_bool_type; - - operator unspecified_bool_type() const BOOST_NOEXCEPT - { - return px == 0? 0: &this_type::px; - } - -#endif - - // operator! is redundant, but some compilers need it - bool operator! () const BOOST_NOEXCEPT - { - return px == 0; - } diff --git a/cutl/details/boost/smart_ptr/detail/quick_allocator.hpp b/cutl/details/boost/smart_ptr/detail/quick_allocator.hpp deleted file mode 100644 index 77e4731..0000000 --- a/cutl/details/boost/smart_ptr/detail/quick_allocator.hpp +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/quick_allocator.hpp -// -// Copyright (c) 2003 David Abrahams -// Copyright (c) 2003 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 - -#include -#include -#include - -#include // ::operator new, ::operator delete -#include // std::size_t - -namespace cutl_details_boost -{ - -namespace detail -{ - -template union freeblock -{ - typedef typename cutl_details_boost::type_with_alignment::type aligner_type; - aligner_type aligner; - char bytes[size]; - freeblock * next; -}; - -template struct allocator_impl -{ - typedef freeblock block; - - // It may seem odd to use such small pages. - // - // However, on a typical Windows implementation that uses - // the OS allocator, "normal size" pages interact with the - // "ordinary" operator new, slowing it down dramatically. - // - // 512 byte pages are handled by the small object allocator, - // and don't interfere with ::new. - // - // The other alternative is to use much bigger pages (1M.) - // - // It is surprisingly easy to hit pathological behavior by - // varying the page size. g++ 2.96 on Red Hat Linux 7.2, - // for example, passionately dislikes 496. 512 seems OK. - -#if defined(BOOST_QA_PAGE_SIZE) - - enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; - -#else - - enum { items_per_page = 512 / size }; // 1048560 / size - -#endif - -#ifdef BOOST_HAS_THREADS - - static lightweight_mutex & mutex() - { - static freeblock< sizeof( lightweight_mutex ), cutl_details_boost::alignment_of< lightweight_mutex >::value > fbm; - static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; - return *pm; - } - - static lightweight_mutex * mutex_init; - -#endif - - static block * free; - static block * page; - static unsigned last; - - static inline void * alloc() - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - // "Listen to me carefully: there is no memory leak" - // -- Scott Meyers, Eff C++ 2nd Ed Item 10 - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - - static inline void * alloc(std::size_t n) - { - if(n != size) // class-specific new called for a derived object - { - return ::operator new(n); - } - else - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - } - - static inline void dealloc(void * pv) - { - if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - block * pb = static_cast(pv); - pb->next = free; - free = pb; - } - } - - static inline void dealloc(void * pv, std::size_t n) - { - if(n != size) // class-specific delete called for a derived object - { - ::operator delete(pv); - } - else if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - block * pb = static_cast(pv); - pb->next = free; - free = pb; - } - } -}; - -#ifdef BOOST_HAS_THREADS - -template - lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); - -#endif - -template - freeblock * allocator_impl::free = 0; - -template - freeblock * allocator_impl::page = 0; - -template - unsigned allocator_impl::last = allocator_impl::items_per_page; - -template -struct quick_allocator: public allocator_impl< sizeof(T), cutl_details_boost::alignment_of::value > -{ -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/shared_count.hpp b/cutl/details/boost/smart_ptr/detail/shared_count.hpp deleted file mode 100644 index 77aea5c..0000000 --- a/cutl/details/boost/smart_ptr/detail/shared_count.hpp +++ /dev/null @@ -1,603 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/shared_count.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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) -// - -#ifdef __BORLANDC__ -# pragma warn -8027 // Functions containing try are not expanded inline -#endif - -#include -#include -#include -#include -#include -#include -#include -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr -#include // std::less - -#ifdef BOOST_NO_EXCEPTIONS -# include // std::bad_alloc -#endif - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) -# include -#endif - -namespace cutl_details_boost -{ - -namespace detail -{ - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -int const shared_count_id = 0x2C35F101; -int const weak_count_id = 0x298C38A4; - -#endif - -struct sp_nothrow_tag {}; - -template< class D > struct sp_inplace_tag -{ -}; - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) - -template< class T > class sp_reference_wrapper -{ -public: - - explicit sp_reference_wrapper( T & t): t_( cutl_details_boost::addressof( t ) ) - { - } - - template< class Y > void operator()( Y * p ) const - { - (*t_)( p ); - } - -private: - - T * t_; -}; - -template< class D > struct sp_convert_reference -{ - typedef D type; -}; - -template< class D > struct sp_convert_reference< D& > -{ - typedef sp_reference_wrapper< D > type; -}; - -#endif - -class weak_count; - -class shared_count -{ -private: - - sp_counted_base * pi_; - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - int id_; -#endif - - friend class weak_count; - -public: - - shared_count(): pi_(0) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - } - - template explicit shared_count( Y * p ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_p( p ); - } - catch(...) - { - cutl_details_boost::checked_delete( p ); - throw; - } - -#else - - pi_ = new sp_counted_impl_p( p ); - - if( pi_ == 0 ) - { - cutl_details_boost::checked_delete( p ); - cutl_details_boost::throw_exception( std::bad_alloc() ); - } - -#endif - } - -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) - template shared_count( Y * p, D d ): pi_(0) -#else - template shared_count( P p, D d ): pi_(0) -#endif -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) - typedef Y* P; -#endif -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_pd(p, d); - } - catch(...) - { - d(p); // delete p - throw; - } - -#else - - pi_ = new sp_counted_impl_pd(p, d); - - if(pi_ == 0) - { - d(p); // delete p - cutl_details_boost::throw_exception(std::bad_alloc()); - } - -#endif - } - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template< class P, class D > shared_count( P p, sp_inplace_tag ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_pd< P, D >( p ); - } - catch( ... ) - { - D::operator_fn( p ); // delete p - throw; - } - -#else - - pi_ = new sp_counted_impl_pd< P, D >( p ); - - if( pi_ == 0 ) - { - D::operator_fn( p ); // delete p - cutl_details_boost::throw_exception( std::bad_alloc() ); - } - -#endif // #ifndef BOOST_NO_EXCEPTIONS - } - -#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template shared_count( P p, D d, A a ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef sp_counted_impl_pda impl_type; - typedef typename A::template rebind< impl_type >::other A2; - - A2 a2( a ); - -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); - new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); - } - catch(...) - { - d( p ); - - if( pi_ != 0 ) - { - a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); - } - - throw; - } - -#else - - pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); - - if( pi_ != 0 ) - { - new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); - } - else - { - d( p ); - cutl_details_boost::throw_exception( std::bad_alloc() ); - } - -#endif - } - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef sp_counted_impl_pda< P, D, A > impl_type; - typedef typename A::template rebind< impl_type >::other A2; - - A2 a2( a ); - -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); - new( static_cast< void* >( pi_ ) ) impl_type( p, a ); - } - catch(...) - { - D::operator_fn( p ); - - if( pi_ != 0 ) - { - a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); - } - - throw; - } - -#else - - pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); - - if( pi_ != 0 ) - { - new( static_cast< void* >( pi_ ) ) impl_type( p, a ); - } - else - { - D::operator_fn( p ); - cutl_details_boost::throw_exception( std::bad_alloc() ); - } - -#endif // #ifndef BOOST_NO_EXCEPTIONS - } - -#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - -#ifndef BOOST_NO_AUTO_PTR - - // auto_ptr is special cased to provide the strong guarantee - - template - explicit shared_count( std::auto_ptr & r ): pi_( new sp_counted_impl_p( r.get() ) ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - cutl_details_boost::throw_exception(std::bad_alloc()); - } - -#endif - - r.release(); - } - -#endif - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) - - template - explicit shared_count( std::unique_ptr & r ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef typename sp_convert_reference::type D2; - - D2 d2( r.get_deleter() ); - pi_ = new sp_counted_impl_pd< typename std::unique_ptr::pointer, D2 >( r.get(), d2 ); - -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - cutl_details_boost::throw_exception( std::bad_alloc() ); - } - -#endif - - r.release(); - } - -#endif - - ~shared_count() // nothrow - { - if( pi_ != 0 ) pi_->release(); -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - id_ = 0; -#endif - } - - shared_count(shared_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - if( pi_ != 0 ) pi_->add_ref_copy(); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_count(shared_count && r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - r.pi_ = 0; - } - -#endif - - explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 - shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 - - shared_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if( tmp != 0 ) tmp->add_ref_copy(); - if( pi_ != 0 ) pi_->release(); - pi_ = tmp; - } - - return *this; - } - - void swap(shared_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool unique() const // nothrow - { - return use_count() == 1; - } - - bool empty() const // nothrow - { - return pi_ == 0; - } - - friend inline bool operator==(shared_count const & a, shared_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(shared_count const & a, shared_count const & b) - { - return std::less()( a.pi_, b.pi_ ); - } - - void * get_deleter( sp_typeinfo const & ti ) const - { - return pi_? pi_->get_deleter( ti ): 0; - } - - void * get_untyped_deleter() const - { - return pi_? pi_->get_untyped_deleter(): 0; - } -}; - - -class weak_count -{ -private: - - sp_counted_base * pi_; - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - int id_; -#endif - - friend class shared_count; - -public: - - weak_count(): pi_(0) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - } - - weak_count(shared_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - if(pi_ != 0) pi_->weak_add_ref(); - } - - weak_count(weak_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - if(pi_ != 0) pi_->weak_add_ref(); - } - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - weak_count(weak_count && r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - r.pi_ = 0; - } - -#endif - - ~weak_count() // nothrow - { - if(pi_ != 0) pi_->weak_release(); -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - id_ = 0; -#endif - } - - weak_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - } - - return *this; - } - - weak_count & operator= (weak_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - } - - return *this; - } - - void swap(weak_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool empty() const // nothrow - { - return pi_ == 0; - } - - friend inline bool operator==(weak_count const & a, weak_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(weak_count const & a, weak_count const & b) - { - return std::less()(a.pi_, b.pi_); - } -}; - -inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif -{ - if( pi_ == 0 || !pi_->add_ref_lock() ) - { - cutl_details_boost::throw_exception( cutl_details_boost::bad_weak_ptr() ); - } -} - -inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif -{ - if( pi_ != 0 && !pi_->add_ref_lock() ) - { - pi_ = 0; - } -} - -} // namespace detail - -} // namespace cutl_details_boost - -#ifdef __BORLANDC__ -# pragma warn .8027 // Functions containing try are not expanded inline -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/shared_ptr_nmt.hpp b/cutl/details/boost/smart_ptr/detail/shared_ptr_nmt.hpp deleted file mode 100644 index e84e696..0000000 --- a/cutl/details/boost/smart_ptr/detail/shared_ptr_nmt.hpp +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED - -// -// detail/shared_ptr_nmt.hpp - shared_ptr.hpp without member templates -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 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) -// -// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. -// - -#include -#include -#include -#include - -#ifndef BOOST_NO_AUTO_PTR -# include // for std::auto_ptr -#endif - -#include // for std::swap -#include // for std::less -#include // for std::bad_alloc - -namespace cutl_details_boost -{ - -template class shared_ptr -{ -private: - - typedef detail::atomic_count count_type; - -public: - - typedef T element_type; - typedef T value_type; - - explicit shared_ptr(T * p = 0): px(p) - { -#ifndef BOOST_NO_EXCEPTIONS - - try // prevent leak if new throws - { - pn = new count_type(1); - } - catch(...) - { - cutl_details_boost::checked_delete(p); - throw; - } - -#else - - pn = new count_type(1); - - if(pn == 0) - { - cutl_details_boost::checked_delete(p); - cutl_details_boost::throw_exception(std::bad_alloc()); - } - -#endif - } - - ~shared_ptr() - { - if(--*pn == 0) - { - cutl_details_boost::checked_delete(px); - delete pn; - } - } - - shared_ptr(shared_ptr const & r): px(r.px) // never throws - { - pn = r.pn; - ++*pn; - } - - shared_ptr & operator=(shared_ptr const & r) - { - shared_ptr(r).swap(*this); - return *this; - } - -#ifndef BOOST_NO_AUTO_PTR - - explicit shared_ptr(std::auto_ptr & r) - { - pn = new count_type(1); // may throw - px = r.release(); // fix: moved here to stop leak if new throws - } - - shared_ptr & operator=(std::auto_ptr & r) - { - shared_ptr(r).swap(*this); - return *this; - } - -#endif - - void reset(T * p = 0) - { - BOOST_ASSERT(p == 0 || p != px); - shared_ptr(p).swap(*this); - } - - T & operator*() const // never throws - { - BOOST_ASSERT(px != 0); - return *px; - } - - T * operator->() const // never throws - { - BOOST_ASSERT(px != 0); - return px; - } - - T * get() const // never throws - { - return px; - } - - long use_count() const // never throws - { - return *pn; - } - - bool unique() const // never throws - { - return *pn == 1; - } - - void swap(shared_ptr & other) // never throws - { - std::swap(px, other.px); - std::swap(pn, other.pn); - } - -private: - - T * px; // contained pointer - count_type * pn; // ptr to reference counter -}; - -template inline bool operator==(shared_ptr const & a, shared_ptr const & b) -{ - return a.get() == b.get(); -} - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) -{ - return a.get() != b.get(); -} - -template inline bool operator<(shared_ptr const & a, shared_ptr const & b) -{ - return std::less()(a.get(), b.get()); -} - -template void swap(shared_ptr & a, shared_ptr & b) -{ - a.swap(b); -} - -// get_pointer() enables cutl_details_boost::mem_fn to recognize shared_ptr - -template inline T * get_pointer(shared_ptr const & p) -{ - return p.get(); -} - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp b/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp deleted file mode 100644 index f9ee9e0..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_convertible.hpp -// -// Copyright 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 - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - -namespace cutl_details_boost -{ - -namespace detail -{ - -template< class Y, class T > struct sp_convertible -{ - typedef char (&yes) [1]; - typedef char (&no) [2]; - - static yes f( T* ); - static no f( ... ); - - enum _vt { value = sizeof( (f)( static_cast(0) ) ) == sizeof(yes) }; -}; - -template< class Y, class T > struct sp_convertible< Y, T[] > -{ - enum _vt { value = false }; -}; - -template< class Y, class T > struct sp_convertible< Y[], T[] > -{ - enum _vt { value = sp_convertible< Y[1], T[1] >::value }; -}; - -template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] > -{ - enum _vt { value = sp_convertible< Y[1], T[1] >::value }; -}; - -struct sp_empty -{ -}; - -template< bool > struct sp_enable_if_convertible_impl; - -template<> struct sp_enable_if_convertible_impl -{ - typedef sp_empty type; -}; - -template<> struct sp_enable_if_convertible_impl -{ -}; - -template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > -{ -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp deleted file mode 100644 index 9a36bf9..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base.hpp -// -// Copyright 2005, 2006 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 -#include - -#if defined( BOOST_SP_DISABLE_THREADS ) -# include - -#elif defined( BOOST_SP_USE_SPINLOCK ) -# include - -#elif defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) -# include - -#elif defined( __SNC__ ) -# include - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) -# include - -#elif defined(__HP_aCC) && defined(__ia64) -# include - -#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__) -# include - -#elif defined( __IBMCPP__ ) && defined( __powerpc ) -# include - -#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) -# include - -#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX ) -# include - -#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) -# include - -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) -# include - -#elif defined( _AIX ) -# include - -#elif !defined( BOOST_HAS_THREADS ) -# include - -#else -# include - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp deleted file mode 100644 index 6b3b551..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +++ /dev/null @@ -1,151 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED - -// -// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 -// -// Copyright 2007 Baruch Zilber -// Copyright 2007 Boris Gubenko -// -// 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) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int r = static_cast(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); - if (1 == r) - { - _Asm_mf(); - } - - return r - 1; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int v = *pw; - - for (;;) - { - if (0 == v) - { - return 0; - } - - _Asm_mov_to_ar(_AREG_CCV, - v, - (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); - int r = static_cast(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); - if (r == v) - { - return r + 1; - } - - v = r; - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); // TODO use ld.acq here - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp deleted file mode 100644 index 6b66a7b..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED - -// -// detail/sp_counted_base_aix.hpp -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// -// 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) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( int32_t* pw ) -{ - // ++*pw; - - fetch_and_add( pw, 1 ); -} - -inline int32_t atomic_decrement( int32_t * pw ) -{ - // return --*pw; - - int32_t originalValue; - - __lwsync(); - originalValue = fetch_and_add( pw, -1 ); - __isync(); - - return (originalValue - 1); -} - -inline int32_t atomic_conditional_increment( int32_t * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int32_t tmp = fetch_and_add( pw, 0 ); - for( ;; ) - { - if( tmp == 0 ) return 0; - if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1); - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int32_t use_count_; // #shared - int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return fetch_and_add( const_cast(&use_count_), 0 ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp deleted file mode 100644 index 4500914..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( register long * pw ) -{ - register int a; - - asm - { -loop: - - lwarx a, 0, pw - addi a, a, 1 - stwcx. a, 0, pw - bne- loop - } -} - -inline long atomic_decrement( register long * pw ) -{ - register int a; - - asm - { - sync - -loop: - - lwarx a, 0, pw - addi a, a, -1 - stwcx. a, 0, pw - bne- loop - - isync - } - - return a; -} - -inline long atomic_conditional_increment( register long * pw ) -{ - register int a; - - asm - { -loop: - - lwarx a, 0, pw - cmpwi a, 0 - beq store - - addi a, a, 1 - -store: - - stwcx. a, 0, pw - bne- loop - } - - return a; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp deleted file mode 100644 index d04f19f..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED - -// -// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2006 Peter Dimov -// Copyright 2005 Ben Hutchings -// -// 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) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - // No barrier is required here but fetchadd always has an acquire or - // release barrier associated with it. We choose release as it should be - // cheaper. - __asm__ ("fetchadd4.rel %0=%1,1" : - "=r"(tmp), "=m"(*pw) : - "m"( *pw )); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" - " cmp.eq p7,p0=1,%0 ;; \n" - "(p7) ld4.acq %0=%1 " : - "=&r"(rv), "=m"(*pw) : - "m"( *pw ) : - "p7"); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv, tmp, tmp2; - - __asm__ ("0: ld4 %0=%3 ;; \n" - " cmp.eq p7,p0=0,%0 ;; \n" - "(p7) br.cond.spnt 1f \n" - " mov ar.ccv=%0 \n" - " add %1=1,%0 ;; \n" - " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" - " cmp.ne p7,p0=%0,%2 ;; \n" - "(p7) br.cond.spnt 0b \n" - " mov %0=%1 ;; \n" - "1:" : - "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : - "m"( *pw ) : - "ar.ccv", "p7"); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); // TODO use ld.acq here - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp deleted file mode 100644 index 0fd16f3..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_mips.hpp - g++ on MIPS -// -// Copyright (c) 2009, Spirent Communications, Inc. -// -// 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) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0, %1\n\t" - "addiu %0, 1\n\t" - "sc %0, %1\n\t" - ".set pop\n\t" - "beqz %0, 0b": - "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ) - ); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv, tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %1, %2\n\t" - "addiu %0, %1, -1\n\t" - "sc %0, %2\n\t" - ".set pop\n\t" - "beqz %0, 0b\n\t" - "addiu %0, %1, -1": - "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ): - "memory" - ); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv, tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0, %2\n\t" - "beqz %0, 1f\n\t" - "addiu %1, %0, 1\n\t" - "sc %1, %2\n\t" - ".set pop\n\t" - "beqz %1, 0b\n\t" - "addiu %0, %0, 1\n\t" - "1:": - "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ): - "memory" - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp deleted file mode 100644 index a302b3a..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, 1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( tmp ): - "r"( pw ), "m"( *pw ): - "cc" - ); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ __volatile__ - ( - "sync\n\t" - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, -1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b\n\t" - "isync": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "memory", "cc" - ); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "cmpwi %1, 0\n\t" - "beq 1f\n\t" - "addi %1, %1, 1\n\t" - "1:\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "cc" - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp deleted file mode 100644 index 8121760..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ -// -// Copyright (c) 2006 Piotr Wyderski -// Copyright (c) 2006 Tomas Puverle -// Copyright (c) 2006 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 -// -// Thanks to Michael van der Westhuizen - -#include -#include // int32_t - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) -{ - __asm__ __volatile__( "cas [%1], %2, %0" - : "+r" (swap_) - : "r" (dest_), "r" (compare_) - : "memory" ); - - return swap_; -} - -inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) -{ - // long r = *pw; - // *pw += dv; - // return r; - - for( ;; ) - { - int32_t r = *pw; - - if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) - { - return r; - } - } -} - -inline void atomic_increment( int32_t * pw ) -{ - atomic_fetch_and_add( pw, 1 ); -} - -inline int32_t atomic_decrement( int32_t * pw ) -{ - return atomic_fetch_and_add( pw, -1 ); -} - -inline int32_t atomic_conditional_increment( int32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - for( ;; ) - { - int32_t r = *pw; - - if( r == 0 ) - { - return r; - } - - if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int32_t use_count_; // #shared - int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< int32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp deleted file mode 100644 index fc3d72b..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +++ /dev/null @@ -1,174 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64 -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - // int r = *pw; - // *pw += dv; - // return r; - - int r; - - __asm__ __volatile__ - ( - "lock\n\t" - "xadd %1, %0": - "=m"( *pw ), "=r"( r ): // outputs (%0, %1) - "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) - "memory", "cc" // clobbers - ); - - return r; -} - -inline void atomic_increment( int * pw ) -{ - //atomic_exchange_and_add( pw, 1 ); - - __asm__ - ( - "lock\n\t" - "incl %0": - "=m"( *pw ): // output (%0) - "m"( *pw ): // input (%1) - "cc" // clobbers - ); -} - -inline int atomic_conditional_increment( int * pw ) -{ - // int rv = *pw; - // if( rv != 0 ) ++*pw; - // return rv; - - int rv, tmp; - - __asm__ - ( - "movl %0, %%eax\n\t" - "0:\n\t" - "test %%eax, %%eax\n\t" - "je 1f\n\t" - "movl %%eax, %2\n\t" - "incl %2\n\t" - "lock\n\t" - "cmpxchgl %2, %0\n\t" - "jne 0b\n\t" - "1:": - "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) - "m"( *pw ): // input (%3) - "cc" // clobbers - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp deleted file mode 100644 index 92c1ee2..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_nt.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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 - -namespace cutl_details_boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - ++use_count_; - } - - bool add_ref_lock() // true on success - { - if( use_count_ == 0 ) return false; - ++use_count_; - return true; - } - - void release() // nothrow - { - if( --use_count_ == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - ++weak_count_; - } - - void weak_release() // nothrow - { - if( --weak_count_ == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return use_count_; - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp deleted file mode 100644 index 7ba3867..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_pt.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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 -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - - mutable pthread_mutex_t m_; - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - pthread_mutex_init( &m_, pthread_mutexattr_default ); -#else - pthread_mutex_init( &m_, 0 ); -#endif - } - - virtual ~sp_counted_base() // nothrow - { - pthread_mutex_destroy( &m_ ); - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - pthread_mutex_lock( &m_ ); - ++use_count_; - pthread_mutex_unlock( &m_ ); - } - - bool add_ref_lock() // true on success - { - pthread_mutex_lock( &m_ ); - bool r = use_count_ == 0? false: ( ++use_count_, true ); - pthread_mutex_unlock( &m_ ); - return r; - } - - void release() // nothrow - { - pthread_mutex_lock( &m_ ); - long new_use_count = --use_count_; - pthread_mutex_unlock( &m_ ); - - if( new_use_count == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - pthread_mutex_lock( &m_ ); - ++weak_count_; - pthread_mutex_unlock( &m_ ); - } - - void weak_release() // nothrow - { - pthread_mutex_lock( &m_ ); - long new_weak_count = --weak_count_; - pthread_mutex_unlock( &m_ ); - - if( new_weak_count == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - pthread_mutex_lock( &m_ ); - long r = use_count_; - pthread_mutex_unlock( &m_ ); - - return r; - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp deleted file mode 100644 index 56fce3d..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ -// -// Copyright (c) 2006 Piotr Wyderski -// Copyright (c) 2006 Tomas Puverle -// Copyright (c) 2006 Peter Dimov -// Copyright (c) 2011 Emil Dotchevski -// -// 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 -// -// Thanks to Michael van der Westhuizen - -#include -#include // uint32_t - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline uint32_t compare_and_swap( uint32_t * dest_, uint32_t compare_, uint32_t swap_ ) -{ - return __builtin_cellAtomicCompareAndSwap32(dest_,compare_,swap_); -} - -inline uint32_t atomic_fetch_and_add( uint32_t * pw, uint32_t dv ) -{ - // long r = *pw; - // *pw += dv; - // return r; - - for( ;; ) - { - uint32_t r = *pw; - - if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) - { - return r; - } - } -} - -inline void atomic_increment( uint32_t * pw ) -{ - (void) __builtin_cellAtomicIncr32( pw ); -} - -inline uint32_t atomic_decrement( uint32_t * pw ) -{ - return __builtin_cellAtomicDecr32( pw ); -} - -inline uint32_t atomic_conditional_increment( uint32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - for( ;; ) - { - uint32_t r = *pw; - - if( r == 0 ) - { - return r; - } - - if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - uint32_t use_count_; // #shared - uint32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< uint32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp deleted file mode 100644 index 0f95421..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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 -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - - int r = *pw; - *pw += dv; - return r; -} - -inline void atomic_increment( int * pw ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - ++*pw; -} - -inline int atomic_conditional_increment( int * pw ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - - int rv = *pw; - if( rv != 0 ) ++*pw; - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - spinlock_pool<1>::scoped_lock lock( &use_count_ ); - return use_count_; - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp deleted file mode 100644 index b1a0b35..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics -// -// Copyright (c) 2007 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 -#include - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace cutl_details_boost -{ - -namespace detail -{ - -#if INT_MAX >= 2147483647 - -typedef int sp_int32_t; - -#else - -typedef long sp_int32_t; - -#endif - -inline void atomic_increment( sp_int32_t * pw ) -{ - __sync_fetch_and_add( pw, 1 ); -} - -inline sp_int32_t atomic_decrement( sp_int32_t * pw ) -{ - return __sync_fetch_and_add( pw, -1 ); -} - -inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - sp_int32_t r = *pw; - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); - - if( r2 == r ) - { - return r; - } - else - { - r = r2; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - sp_int32_t use_count_; // #shared - sp_int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< sp_int32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp deleted file mode 100644 index 3973606..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +++ /dev/null @@ -1,151 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED - -// -// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// Copyright 2012 IBM Corp. -// -// 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) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -extern "builtin" void __lwsync(void); -extern "builtin" void __isync(void); -extern "builtin" int __fetch_and_add(volatile int* addr, int val); -extern "builtin" int __compare_and_swap(volatile int*, int*, int); - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void atomic_increment( int *pw ) -{ - // ++*pw; - __lwsync(); - __fetch_and_add(pw, 1); - __isync(); -} - -inline int atomic_decrement( int *pw ) -{ - // return --*pw; - __lwsync(); - int originalValue = __fetch_and_add(pw, -1); - __isync(); - - return (originalValue - 1); -} - -inline int atomic_conditional_increment( int *pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - __lwsync(); - int v = *const_cast(pw); - for (;;) - // loop until state is known - { - if (v == 0) return 0; - if (__compare_and_swap(pw, &v, v + 1)) - { - __isync(); return (v + 1); - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - char pad[64] __attribute__((__aligned__(64))); - // pad to prevent false sharing -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return *const_cast(&use_count_); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp deleted file mode 100644 index 63c7d7e..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include -#include - -namespace cutl_details_boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - BOOST_INTERLOCKED_INCREMENT( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - for( ;; ) - { - long tmp = static_cast< long const volatile& >( use_count_ ); - if( tmp == 0 ) return false; - -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) - - // work around a code generation bug - - long tmp2 = tmp + 1; - if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; - -#else - - if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; - -#endif - } - } - - void release() // nothrow - { - if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - BOOST_INTERLOCKED_INCREMENT( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( BOOST_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp deleted file mode 100644 index d958544..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_impl.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-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 - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) -# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. -#endif - -#include -#include - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) -#include -#endif - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) -#include // std::allocator -#endif - -#include // std::size_t - -namespace cutl_details_boost -{ - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); -void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); - -#endif - -namespace detail -{ - -template class sp_counted_impl_p: public sp_counted_base -{ -private: - - X * px_; - - sp_counted_impl_p( sp_counted_impl_p const & ); - sp_counted_impl_p & operator= ( sp_counted_impl_p const & ); - - typedef sp_counted_impl_p this_type; - -public: - - explicit sp_counted_impl_p( X * px ): px_( px ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_scalar_constructor_hook( px, sizeof(X), this ); -#endif - } - - virtual void dispose() // nothrow - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); -#endif - cutl_details_boost::checked_delete( px_ ); - } - - virtual void * get_deleter( detail::sp_typeinfo const & ) - { - return 0; - } - - virtual void * get_untyped_deleter() - { - return 0; - } - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) - - void * operator new( std::size_t ) - { - return std::allocator().allocate( 1, static_cast(0) ); - } - - void operator delete( void * p ) - { - std::allocator().deallocate( static_cast(p), 1 ); - } - -#endif - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) - - void * operator new( std::size_t ) - { - return quick_allocator::alloc(); - } - - void operator delete( void * p ) - { - quick_allocator::dealloc( p ); - } - -#endif -}; - -// -// Borland's Codeguard trips up over the -Vx- option here: -// -#ifdef __CODEGUARD__ -# pragma option push -Vx- -#endif - -template class sp_counted_impl_pd: public sp_counted_base -{ -private: - - P ptr; // copy constructor must not throw - D del; // copy constructor must not throw - - sp_counted_impl_pd( sp_counted_impl_pd const & ); - sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); - - typedef sp_counted_impl_pd this_type; - -public: - - // pre: d(p) must not throw - - sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) - { - } - - sp_counted_impl_pd( P p ): ptr( p ), del() - { - } - - virtual void dispose() // nothrow - { - del( ptr ); - } - - virtual void * get_deleter( detail::sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; - } - - virtual void * get_untyped_deleter() - { - return &reinterpret_cast( del ); - } - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) - - void * operator new( std::size_t ) - { - return std::allocator().allocate( 1, static_cast(0) ); - } - - void operator delete( void * p ) - { - std::allocator().deallocate( static_cast(p), 1 ); - } - -#endif - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) - - void * operator new( std::size_t ) - { - return quick_allocator::alloc(); - } - - void operator delete( void * p ) - { - quick_allocator::dealloc( p ); - } - -#endif -}; - -template class sp_counted_impl_pda: public sp_counted_base -{ -private: - - P p_; // copy constructor must not throw - D d_; // copy constructor must not throw - A a_; // copy constructor must not throw - - sp_counted_impl_pda( sp_counted_impl_pda const & ); - sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); - - typedef sp_counted_impl_pda this_type; - -public: - - // pre: d( p ) must not throw - - sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) - { - } - - sp_counted_impl_pda( P p, A a ): p_( p ), d_(), a_( a ) - { - } - - virtual void dispose() // nothrow - { - d_( p_ ); - } - - virtual void destroy() // nothrow - { - typedef typename A::template rebind< this_type >::other A2; - - A2 a2( a_ ); - - this->~this_type(); - a2.deallocate( this, 1 ); - } - - virtual void * get_deleter( detail::sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; - } - - virtual void * get_untyped_deleter() - { - return &reinterpret_cast( d_ ); - } -}; - -#ifdef __CODEGUARD__ -# pragma option pop -#endif - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp b/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp deleted file mode 100644 index 16de21d..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp +++ /dev/null @@ -1,69 +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. -// - -#ifndef BOOST_SP_NO_SYNC - -#if defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) - -# define BOOST_SP_HAS_SYNC - -#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) - -# define BOOST_SP_HAS_SYNC - -#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -#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( __sh__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sparc__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) -#undef BOOST_SP_HAS_SYNC -#endif - -#endif - -#endif // #ifndef BOOST_SP_NO_SYNC - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp b/cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp deleted file mode 100644 index 245dd22..0000000 --- a/cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_nullptr_t.hpp -// -// Copyright 2013 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 -#include - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -namespace cutl_details_boost -{ - -namespace detail -{ - -#if defined( __clang__ ) && !defined( _LIBCPP_VERSION ) && !defined( BOOST_NO_CXX11_DECLTYPE ) - - typedef decltype(nullptr) sp_nullptr_t; - -#else - - typedef std::nullptr_t sp_nullptr_t; - -#endif - -} // namespace detail - -} // namespace cutl_details_boost - -#endif // !defined( BOOST_NO_CXX11_NULLPTR ) - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock.hpp b/cutl/details/boost/smart_ptr/detail/spinlock.hpp deleted file mode 100644 index ffc70c5..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock.hpp +++ /dev/null @@ -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 -// - -#include -#include - -#if defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include - -#elif defined(BOOST_HAS_PTHREADS) -# include - -#elif !defined(BOOST_HAS_THREADS) -# include - -#else -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp deleted file mode 100644 index 752c830..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +++ /dev/null @@ -1,120 +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, 2011 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 - -#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__) - -# define BOOST_SP_ARM_BARRIER "dmb" -# define BOOST_SP_ARM_HAS_LDREX - -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) - -# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5" -# define BOOST_SP_ARM_HAS_LDREX - -#else - -# define BOOST_SP_ARM_BARRIER "" - -#endif - -namespace cutl_details_boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - int v_; - -public: - - bool try_lock() - { - int r; - -#ifdef BOOST_SP_ARM_HAS_LDREX - - __asm__ __volatile__( - "ldrex %0, [%2]; \n" - "cmp %0, %1; \n" - "strexne %0, %1, [%2]; \n" - BOOST_SP_ARM_BARRIER : - "=&r"( r ): // outputs - "r"( 1 ), "r"( &v_ ): // inputs - "memory", "cc" ); - -#else - - __asm__ __volatile__( - "swp %0, %1, [%2];\n" - BOOST_SP_ARM_BARRIER : - "=&r"( r ): // outputs - "r"( 1 ), "r"( &v_ ): // inputs - "memory", "cc" ); - -#endif - - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - cutl_details_boost::detail::yield( k ); - } - } - - void unlock() - { - __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "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 cutl_details_boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#undef BOOST_SP_ARM_BARRIER -#undef BOOST_SP_ARM_HAS_LDREX - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_nt.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_nt.hpp deleted file mode 100644 index 5ccad17..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock_nt.hpp +++ /dev/null @@ -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 - -namespace cutl_details_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 cutl_details_boost - -#define BOOST_DETAIL_SPINLOCK_INIT { false } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp deleted file mode 100644 index 8ae09e3..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp +++ /dev/null @@ -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 -#include -#include - -namespace cutl_details_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 cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_pt.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_pt.hpp deleted file mode 100644 index 20c483c..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock_pt.hpp +++ /dev/null @@ -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 - -namespace cutl_details_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 cutl_details_boost - -#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_sync.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_sync.hpp deleted file mode 100644 index 1e0abf8..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock_sync.hpp +++ /dev/null @@ -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 - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace cutl_details_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 ) - { - cutl_details_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 cutl_details_boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_w32.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_w32.hpp deleted file mode 100644 index 89031c7..0000000 --- a/cutl/details/boost/smart_ptr/detail/spinlock_w32.hpp +++ /dev/null @@ -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 -#include - -// 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 cutl_details_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 ) - { - cutl_details_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 cutl_details_boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/detail/yield_k.hpp b/cutl/details/boost/smart_ptr/detail/yield_k.hpp deleted file mode 100644 index 31f639d..0000000 --- a/cutl/details/boost/smart_ptr/detail/yield_k.hpp +++ /dev/null @@ -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_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 -#endif - -namespace cutl_details_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 cutl_details_boost - -#elif defined( BOOST_HAS_PTHREADS ) - -#include -#include - -namespace cutl_details_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 cutl_details_boost - -#else - -namespace cutl_details_boost -{ - -namespace detail -{ - -inline void yield( unsigned ) -{ -} - -} // namespace detail - -} // namespace cutl_details_boost - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/scoped_array.hpp b/cutl/details/boost/smart_ptr/scoped_array.hpp deleted file mode 100644 index 60b4c0c..0000000 --- a/cutl/details/boost/smart_ptr/scoped_array.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED -#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 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) -// -// http://www.boost.org/libs/smart_ptr/scoped_array.htm -// - -#include -#include -#include -#include - -#include - -#include // for std::ptrdiff_t - -namespace cutl_details_boost -{ - -// Debug hooks - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_array_constructor_hook(void * p); -void sp_array_destructor_hook(void * p); - -#endif - -// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to -// is guaranteed, either on destruction of the scoped_array or via an explicit -// reset(). Use shared_array or std::vector if your needs are more complex. - -template class scoped_array // noncopyable -{ -private: - - T * px; - - scoped_array(scoped_array const &); - scoped_array & operator=(scoped_array const &); - - typedef scoped_array this_type; - - void operator==( scoped_array const& ) const; - void operator!=( scoped_array const& ) const; - -public: - - typedef T element_type; - - explicit scoped_array( T * p = 0 ) BOOST_NOEXCEPT : px( p ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_array_constructor_hook( px ); -#endif - } - - ~scoped_array() // never throws - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_array_destructor_hook( px ); -#endif - cutl_details_boost::checked_array_delete( px ); - } - - void reset(T * p = 0) // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator[](std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 ); - return px[i]; - } - - T * get() const BOOST_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - void swap(scoped_array & b) BOOST_NOEXCEPT - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( scoped_array const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( cutl_details_boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( scoped_array const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( cutl_details_boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline void swap(scoped_array & a, scoped_array & b) BOOST_NOEXCEPT -{ - a.swap(b); -} - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/scoped_ptr.hpp b/cutl/details/boost/smart_ptr/scoped_ptr.hpp deleted file mode 100644 index 4ddda13..0000000 --- a/cutl/details/boost/smart_ptr/scoped_ptr.hpp +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 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) -// -// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm -// - -#include -#include -#include -#include -#include - -#ifndef BOOST_NO_AUTO_PTR -# include // for std::auto_ptr -#endif - -namespace cutl_details_boost -{ - -// Debug hooks - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_scalar_constructor_hook(void * p); -void sp_scalar_destructor_hook(void * p); - -#endif - -// scoped_ptr mimics a built-in pointer except that it guarantees deletion -// of the object pointed to, either on destruction of the scoped_ptr or via -// an explicit reset(). scoped_ptr is a simple solution for simple needs; -// use shared_ptr or std::auto_ptr if your needs are more complex. - -template class scoped_ptr // noncopyable -{ -private: - - T * px; - - scoped_ptr(scoped_ptr const &); - scoped_ptr & operator=(scoped_ptr const &); - - typedef scoped_ptr this_type; - - void operator==( scoped_ptr const& ) const; - void operator!=( scoped_ptr const& ) const; - -public: - - typedef T element_type; - - explicit scoped_ptr( T * p = 0 ): px( p ) // never throws - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_scalar_constructor_hook( px ); -#endif - } - -#ifndef BOOST_NO_AUTO_PTR - - explicit scoped_ptr( std::auto_ptr p ) BOOST_NOEXCEPT : px( p.release() ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_scalar_constructor_hook( px ); -#endif - } - -#endif - - ~scoped_ptr() // never throws - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - cutl_details_boost::sp_scalar_destructor_hook( px ); -#endif - cutl_details_boost::checked_delete( px ); - } - - void reset(T * p = 0) // never throws - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator*() const // never throws - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - T * operator->() const // never throws - { - BOOST_ASSERT( px != 0 ); - return px; - } - - T * get() const BOOST_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - void swap(scoped_ptr & b) BOOST_NOEXCEPT - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( scoped_ptr const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( cutl_details_boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( scoped_ptr const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( cutl_details_boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline void swap(scoped_ptr & a, scoped_ptr & b) BOOST_NOEXCEPT -{ - a.swap(b); -} - -// get_pointer(p) is a generic way to say p.get() - -template inline T * get_pointer(scoped_ptr const & p) BOOST_NOEXCEPT -{ - return p.get(); -} - -} // namespace cutl_details_boost - -#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED diff --git a/cutl/details/boost/smart_ptr/shared_ptr.hpp b/cutl/details/boost/smart_ptr/shared_ptr.hpp deleted file mode 100644 index f528a7a..0000000 --- a/cutl/details/boost/smart_ptr/shared_ptr.hpp +++ /dev/null @@ -1,1035 +0,0 @@ -#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED - -// -// shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001-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) -// -// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. -// - -#include // for broken compiler workarounds - -#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) -#include -#else - -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr - -#include -#include -#include -#include -#include -#include -#include - -#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) -#include -#include -#endif - -#include // for std::swap -#include // for std::less -#include // for std::bad_cast -#include // for std::size_t - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - -namespace cutl_details_boost -{ - -template class shared_ptr; -template class weak_ptr; -template class enable_shared_from_this; -class enable_shared_from_raw; - -namespace detail -{ - -// sp_element, element_type - -template< class T > struct sp_element -{ - typedef T type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_element< T[] > -{ - typedef T type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_element< T[N] > -{ - typedef T type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_dereference, return type of operator* - -template< class T > struct sp_dereference -{ - typedef T & type; -}; - -template<> struct sp_dereference< void > -{ - typedef void type; -}; - -#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -template<> struct sp_dereference< void const > -{ - typedef void type; -}; - -template<> struct sp_dereference< void volatile > -{ - typedef void type; -}; - -template<> struct sp_dereference< void const volatile > -{ - typedef void type; -}; - -#endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_dereference< T[] > -{ - typedef void type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_dereference< T[N] > -{ - typedef void type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_member_access, return type of operator-> - -template< class T > struct sp_member_access -{ - typedef T * type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_member_access< T[] > -{ - typedef void type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_member_access< T[N] > -{ - typedef void type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_array_access, return type of operator[] - -template< class T > struct sp_array_access -{ - typedef void type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_array_access< T[] > -{ - typedef T & type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_array_access< T[N] > -{ - typedef T & type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_extent, for operator[] index check - -template< class T > struct sp_extent -{ - enum _vt { value = 0 }; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, std::size_t N > struct sp_extent< T[N] > -{ - enum _vt { value = N }; -}; - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// enable_shared_from_this support - -template< class X, class Y, class T > inline void sp_enable_shared_from_this( cutl_details_boost::shared_ptr const * ppx, Y const * py, cutl_details_boost::enable_shared_from_this< T > const * pe ) -{ - if( pe != 0 ) - { - pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); - } -} - -template< class X, class Y > inline void sp_enable_shared_from_this( cutl_details_boost::shared_ptr * ppx, Y const * py, cutl_details_boost::enable_shared_from_raw const * pe ); - -#ifdef _MANAGED - -// Avoid C4793, ... causes native code generation - -struct sp_any_pointer -{ - template sp_any_pointer( T* ) {} -}; - -inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) -{ -} - -#else // _MANAGED - -inline void sp_enable_shared_from_this( ... ) -{ -} - -#endif // _MANAGED - -#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) - -// rvalue auto_ptr support based on a technique by Dave Abrahams - -template< class T, class R > struct sp_enable_if_auto_ptr -{ -}; - -template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > -{ - typedef R type; -}; - -#endif - -// sp_assert_convertible - -template< class Y, class T > inline void sp_assert_convertible() -{ -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - // static_assert( sp_convertible< Y, T >::value ); - typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; - (void)sizeof( tmp ); - -#else - - T* p = static_cast< Y* >( 0 ); - (void)p; - -#endif -} - -// pointer constructor helper - -template< class T, class Y > inline void sp_pointer_construct( cutl_details_boost::shared_ptr< T > * ppx, Y * p, cutl_details_boost::detail::shared_count & pn ) -{ - cutl_details_boost::detail::shared_count( p ).swap( pn ); - cutl_details_boost::detail::sp_enable_shared_from_this( ppx, p, p ); -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, class Y > inline void sp_pointer_construct( cutl_details_boost::shared_ptr< T[] > * /*ppx*/, Y * p, cutl_details_boost::detail::shared_count & pn ) -{ - sp_assert_convertible< Y[], T[] >(); - cutl_details_boost::detail::shared_count( p, cutl_details_boost::checked_array_deleter< T >() ).swap( pn ); -} - -template< class T, std::size_t N, class Y > inline void sp_pointer_construct( cutl_details_boost::shared_ptr< T[N] > * /*ppx*/, Y * p, cutl_details_boost::detail::shared_count & pn ) -{ - sp_assert_convertible< Y[N], T[N] >(); - cutl_details_boost::detail::shared_count( p, cutl_details_boost::checked_array_deleter< T >() ).swap( pn ); -} - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// deleter constructor helper - -template< class T, class Y > inline void sp_deleter_construct( cutl_details_boost::shared_ptr< T > * ppx, Y * p ) -{ - cutl_details_boost::detail::sp_enable_shared_from_this( ppx, p, p ); -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, class Y > inline void sp_deleter_construct( cutl_details_boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ ) -{ - sp_assert_convertible< Y[], T[] >(); -} - -template< class T, std::size_t N, class Y > inline void sp_deleter_construct( cutl_details_boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ ) -{ - sp_assert_convertible< Y[N], T[N] >(); -} - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -} // namespace detail - - -// -// shared_ptr -// -// An enhanced relative of scoped_ptr with reference counted copy semantics. -// The object pointed to is deleted when the last shared_ptr pointing to it -// is destroyed or reset. -// - -template class shared_ptr -{ -private: - - // Borland 5.5.1 specific workaround - typedef shared_ptr this_type; - -public: - - typedef typename cutl_details_boost::detail::sp_element< T >::type element_type; - - shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+ - { - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - shared_ptr( cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws - { - } - -#endif - - template - explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete - { - cutl_details_boost::detail::sp_pointer_construct( this, p, pn ); - } - - // - // Requirements: D's copy constructor must not throw - // - // shared_ptr will release p by calling d(p) - // - - template shared_ptr( Y * p, D d ): px( p ), pn( p, d ) - { - cutl_details_boost::detail::sp_deleter_construct( this, p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template shared_ptr( cutl_details_boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) - { - } - -#endif - - // As above, but with allocator. A's copy constructor shall not throw. - - template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) - { - cutl_details_boost::detail::sp_deleter_construct( this, p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template shared_ptr( cutl_details_boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) - { - } - -#endif - -// generated copy constructor, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// ... except in C++0x, move disables the implicit copy - - shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) - { - } - -#endif - - template - explicit shared_ptr( weak_ptr const & r ): pn( r.pn ) // may throw - { - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - - // it is now safe to copy r.px, as pn(r.pn) did not throw - px = r.px; - } - - template - shared_ptr( weak_ptr const & r, cutl_details_boost::detail::sp_nothrow_tag ) - BOOST_NOEXCEPT : px( 0 ), pn( r.pn, cutl_details_boost::detail::sp_nothrow_tag() ) - { - if( !pn.empty() ) - { - px = r.px; - } - } - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_ptr( shared_ptr const & r, typename cutl_details_boost::detail::sp_enable_if_convertible::type = cutl_details_boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr const & r ) - -#endif - BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) - { - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - } - - // aliasing - template< class Y > - shared_ptr( shared_ptr const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn ) - { - } - -#ifndef BOOST_NO_AUTO_PTR - - template - explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn() - { - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = cutl_details_boost::detail::shared_count( r ); - - cutl_details_boost::detail::sp_deleter_construct( this, tmp ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr( std::auto_ptr && r ): px(r.get()), pn() - { - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = cutl_details_boost::detail::shared_count( r ); - - cutl_details_boost::detail::sp_deleter_construct( this, tmp ); - } - -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - explicit shared_ptr( Ap r, typename cutl_details_boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() - { - typedef typename Ap::element_type Y; - - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = cutl_details_boost::detail::shared_count( r ); - - cutl_details_boost::detail::sp_deleter_construct( this, tmp ); - } - -#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // BOOST_NO_AUTO_PTR - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template< class Y, class D > - shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn() - { - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - - typename std::unique_ptr< Y, D >::pointer tmp = r.get(); - pn = cutl_details_boost::detail::shared_count( r ); - - cutl_details_boost::detail::sp_deleter_construct( this, tmp ); - } - -#endif - - // assignment - - shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT - { - this_type(r).swap(*this); - return *this; - } - -#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) - - template - shared_ptr & operator=(shared_ptr const & r) BOOST_NOEXCEPT - { - this_type(r).swap(*this); - return *this; - } - -#endif - -#ifndef BOOST_NO_AUTO_PTR - - template - shared_ptr & operator=( std::auto_ptr & r ) - { - this_type( r ).swap( *this ); - return *this; - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr & operator=( std::auto_ptr && r ) - { - this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this ); - return *this; - } - -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - typename cutl_details_boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) - { - this_type( r ).swap( *this ); - return *this; - } - -#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // BOOST_NO_AUTO_PTR - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr & operator=( std::unique_ptr && r ) - { - this_type( static_cast< std::unique_ptr && >( r ) ).swap(*this); - return *this; - } - -#endif - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn() - { - pn.swap( r.pn ); - r.px = 0; - } - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_ptr( shared_ptr && r, typename cutl_details_boost::detail::sp_enable_if_convertible::type = cutl_details_boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr && r ) - -#endif - BOOST_NOEXCEPT : px( r.px ), pn() - { - cutl_details_boost::detail::sp_assert_convertible< Y, T >(); - - pn.swap( r.pn ); - r.px = 0; - } - - shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); - return *this; - } - - template - shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); - return *this; - } - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - shared_ptr & operator=( cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws - { - this_type().swap(*this); - return *this; - } - -#endif - - void reset() BOOST_NOEXCEPT // never throws in 1.30+ - { - this_type().swap(*this); - } - - template void reset( Y * p ) // Y must be complete - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type( p ).swap( *this ); - } - - template void reset( Y * p, D d ) - { - this_type( p, d ).swap( *this ); - } - - template void reset( Y * p, D d, A a ) - { - this_type( p, d, a ).swap( *this ); - } - - template void reset( shared_ptr const & r, element_type * p ) - { - this_type( r, p ).swap( *this ); - } - - // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) - typename cutl_details_boost::detail::sp_dereference< T >::type operator* () const - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) - typename cutl_details_boost::detail::sp_member_access< T >::type operator-> () const - { - BOOST_ASSERT( px != 0 ); - return px; - } - - // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) - typename cutl_details_boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 && ( i < cutl_details_boost::detail::sp_extent< T >::value || cutl_details_boost::detail::sp_extent< T >::value == 0 ) ); - - return px[ i ]; - } - - element_type * get() const BOOST_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - bool unique() const BOOST_NOEXCEPT - { - return pn.unique(); - } - - long use_count() const BOOST_NOEXCEPT - { - return pn.use_count(); - } - - void swap( shared_ptr & other ) BOOST_NOEXCEPT - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - template bool owner_before( shared_ptr const & rhs ) const BOOST_NOEXCEPT - { - return pn < rhs.pn; - } - - template bool owner_before( weak_ptr const & rhs ) const BOOST_NOEXCEPT - { - return pn < rhs.pn; - } - - void * _internal_get_deleter( cutl_details_boost::detail::sp_typeinfo const & ti ) const BOOST_NOEXCEPT - { - return pn.get_deleter( ti ); - } - - void * _internal_get_untyped_deleter() const BOOST_NOEXCEPT - { - return pn.get_untyped_deleter(); - } - - bool _internal_equiv( shared_ptr const & r ) const BOOST_NOEXCEPT - { - return px == r.px && pn == r.pn; - } - -// Tasteless as this may seem, making all members public allows member templates -// to work in the absence of member template friends. (Matthew Langston) - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - -private: - - template friend class shared_ptr; - template friend class weak_ptr; - - -#endif - - element_type * px; // contained pointer - cutl_details_boost::detail::shared_count pn; // reference counter - -}; // shared_ptr - -template inline bool operator==(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -{ - return a.get() != b.get(); -} - -#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 - -// Resolve the ambiguity between our op!= and the one in rel_ops - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -{ - return a.get() != b.get(); -} - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( shared_ptr const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( cutl_details_boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( shared_ptr const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( cutl_details_boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline bool operator<(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -{ - return a.owner_before( b ); -} - -template inline void swap(shared_ptr & a, shared_ptr & b) BOOST_NOEXCEPT -{ - a.swap(b); -} - -template shared_ptr static_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -template shared_ptr const_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? shared_ptr( r, p ): shared_ptr(); -} - -template shared_ptr reinterpret_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -// get_pointer() enables cutl_details_boost::mem_fn to recognize shared_ptr - -template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_NOEXCEPT -{ - return p.get(); -} - -// operator<< - -#if !defined(BOOST_NO_IOSTREAM) - -#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) - -template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) -{ - os << p.get(); - return os; -} - -#else - -// in STLport's no-iostreams mode no iostream symbols can be used -#ifndef _STLP_NO_IOSTREAMS - -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) -// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL -using std::basic_ostream; -template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) -# else -template std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) -# endif -{ - os << p.get(); - return os; -} - -#endif // _STLP_NO_IOSTREAMS - -#endif // __GNUC__ < 3 - -#endif // !defined(BOOST_NO_IOSTREAM) - -// get_deleter - -namespace detail -{ - -#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \ - ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \ - ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) ) - -// g++ 2.9x doesn't allow static_cast(void *) -// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it - -template D * basic_get_deleter(shared_ptr const & p) -{ - void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D)); - return const_cast(static_cast(q)); -} - -#else - -template D * basic_get_deleter( shared_ptr const & p ) BOOST_NOEXCEPT -{ - return static_cast( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); -} - -#endif - -class esft2_deleter_wrapper -{ -private: - - shared_ptr deleter_; - -public: - - esft2_deleter_wrapper() - { - } - - template< class T > void set_deleter( shared_ptr const & deleter ) - { - deleter_ = deleter; - } - - template D* get_deleter() const BOOST_NOEXCEPT - { - return cutl_details_boost::detail::basic_get_deleter( deleter_ ); - } - - template< class T> void operator()( T* ) - { - BOOST_ASSERT( deleter_.use_count() <= 1 ); - deleter_.reset(); - } -}; - -} // namespace detail - -template D * get_deleter( shared_ptr const & p ) BOOST_NOEXCEPT -{ - D *del = cutl_details_boost::detail::basic_get_deleter(p); - - if(del == 0) - { - cutl_details_boost::detail::esft2_deleter_wrapper *del_wrapper = cutl_details_boost::detail::basic_get_deleter(p); -// The following get_deleter method call is fully qualified because -// older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter() - if(del_wrapper) del = del_wrapper->::cutl_details_boost::detail::esft2_deleter_wrapper::get_deleter(); - } - - return del; -} - -// atomic access - -#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) - -template inline bool atomic_is_lock_free( shared_ptr const * /*p*/ ) BOOST_NOEXCEPT -{ - return false; -} - -template shared_ptr atomic_load( shared_ptr const * p ) -{ - cutl_details_boost::detail::spinlock_pool<2>::scoped_lock lock( p ); - return *p; -} - -template inline shared_ptr atomic_load_explicit( shared_ptr const * p, memory_order /*mo*/ ) -{ - return atomic_load( p ); -} - -template void atomic_store( shared_ptr * p, shared_ptr r ) -{ - cutl_details_boost::detail::spinlock_pool<2>::scoped_lock lock( p ); - p->swap( r ); -} - -template inline void atomic_store_explicit( shared_ptr * p, shared_ptr r, memory_order /*mo*/ ) -{ - atomic_store( p, r ); // std::move( r ) -} - -template shared_ptr atomic_exchange( shared_ptr * p, shared_ptr r ) -{ - cutl_details_boost::detail::spinlock & sp = cutl_details_boost::detail::spinlock_pool<2>::spinlock_for( p ); - - sp.lock(); - p->swap( r ); - sp.unlock(); - - return r; // return std::move( r ) -} - -template shared_ptr atomic_exchange_explicit( shared_ptr * p, shared_ptr r, memory_order /*mo*/ ) -{ - return atomic_exchange( p, r ); // std::move( r ) -} - -template bool atomic_compare_exchange( shared_ptr * p, shared_ptr * v, shared_ptr w ) -{ - cutl_details_boost::detail::spinlock & sp = cutl_details_boost::detail::spinlock_pool<2>::spinlock_for( p ); - - sp.lock(); - - if( p->_internal_equiv( *v ) ) - { - p->swap( w ); - - sp.unlock(); - - return true; - } - else - { - shared_ptr tmp( *p ); - - sp.unlock(); - - tmp.swap( *v ); - return false; - } -} - -template inline bool atomic_compare_exchange_explicit( shared_ptr * p, shared_ptr * v, shared_ptr w, memory_order /*success*/, memory_order /*failure*/ ) -{ - return atomic_compare_exchange( p, v, w ); // std::move( w ) -} - -#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) - -// hash_value - -template< class T > struct hash; - -template< class T > std::size_t hash_value( cutl_details_boost::shared_ptr const & p ) BOOST_NOEXCEPT -{ - return cutl_details_boost::hash< T* >()( p.get() ); -} - -} // namespace cutl_details_boost - -#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) - -#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -- cgit v1.1