Chris@16
|
1 #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
|
Chris@16
|
2 #define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
|
Chris@16
|
3
|
Chris@16
|
4 // MS compatible compilers support #pragma once
|
Chris@16
|
5
|
Chris@16
|
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
Chris@16
|
7 # pragma once
|
Chris@16
|
8 #endif
|
Chris@16
|
9
|
Chris@16
|
10 //
|
Chris@16
|
11 // boost/detail/spinlock.hpp
|
Chris@16
|
12 //
|
Chris@16
|
13 // Copyright (c) 2008 Peter Dimov
|
Chris@16
|
14 //
|
Chris@16
|
15 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
16 // See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
17 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
18 //
|
Chris@16
|
19 // struct spinlock
|
Chris@16
|
20 // {
|
Chris@16
|
21 // void lock();
|
Chris@16
|
22 // bool try_lock();
|
Chris@16
|
23 // void unlock();
|
Chris@16
|
24 //
|
Chris@16
|
25 // class scoped_lock;
|
Chris@16
|
26 // };
|
Chris@16
|
27 //
|
Chris@16
|
28 // #define BOOST_DETAIL_SPINLOCK_INIT <unspecified>
|
Chris@16
|
29 //
|
Chris@16
|
30
|
Chris@16
|
31 #include <boost/config.hpp>
|
Chris@16
|
32 #include <boost/smart_ptr/detail/sp_has_sync.hpp>
|
Chris@16
|
33
|
Chris@101
|
34 #if defined( BOOST_SP_USE_STD_ATOMIC )
|
Chris@101
|
35 # if !defined( __clang__ )
|
Chris@101
|
36 # include <boost/smart_ptr/detail/spinlock_std_atomic.hpp>
|
Chris@101
|
37 # else
|
Chris@101
|
38 // Clang (at least up to 3.4) can't compile spinlock_pool when
|
Chris@101
|
39 // using std::atomic, so substitute the __sync implementation instead.
|
Chris@101
|
40 # include <boost/smart_ptr/detail/spinlock_sync.hpp>
|
Chris@101
|
41 # endif
|
Chris@101
|
42
|
Chris@101
|
43 #elif defined( BOOST_SP_USE_PTHREADS )
|
Chris@16
|
44 # include <boost/smart_ptr/detail/spinlock_pt.hpp>
|
Chris@16
|
45
|
Chris@16
|
46 #elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
|
Chris@16
|
47 # include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp>
|
Chris@16
|
48
|
Chris@16
|
49 #elif defined( BOOST_SP_HAS_SYNC )
|
Chris@16
|
50 # include <boost/smart_ptr/detail/spinlock_sync.hpp>
|
Chris@16
|
51
|
Chris@16
|
52 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
Chris@16
|
53 # include <boost/smart_ptr/detail/spinlock_w32.hpp>
|
Chris@16
|
54
|
Chris@16
|
55 #elif defined(BOOST_HAS_PTHREADS)
|
Chris@16
|
56 # include <boost/smart_ptr/detail/spinlock_pt.hpp>
|
Chris@16
|
57
|
Chris@16
|
58 #elif !defined(BOOST_HAS_THREADS)
|
Chris@16
|
59 # include <boost/smart_ptr/detail/spinlock_nt.hpp>
|
Chris@16
|
60
|
Chris@16
|
61 #else
|
Chris@16
|
62 # error Unrecognized threading platform
|
Chris@16
|
63 #endif
|
Chris@16
|
64
|
Chris@16
|
65 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
|