Chris@16
|
1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
Chris@16
|
2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_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/atomic_count.hpp - thread/SMP safe reference counter
|
Chris@16
|
12 //
|
Chris@16
|
13 // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
Chris@101
|
14 // Copyright (c) 2013 Peter Dimov
|
Chris@16
|
15 //
|
Chris@101
|
16 // Distributed under the Boost Software License, Version 1.0.
|
Chris@101
|
17 // See accompanying file LICENSE_1_0.txt or copy at
|
Chris@101
|
18 // http://www.boost.org/LICENSE_1_0.txt
|
Chris@16
|
19 //
|
Chris@16
|
20 // typedef <implementation-defined> boost::detail::atomic_count;
|
Chris@16
|
21 //
|
Chris@16
|
22 // atomic_count a(n);
|
Chris@16
|
23 //
|
Chris@16
|
24 // (n is convertible to long)
|
Chris@16
|
25 //
|
Chris@16
|
26 // Effects: Constructs an atomic_count with an initial value of n
|
Chris@16
|
27 //
|
Chris@16
|
28 // a;
|
Chris@16
|
29 //
|
Chris@16
|
30 // Returns: (long) the current value of a
|
Chris@101
|
31 // Memory Ordering: acquire
|
Chris@16
|
32 //
|
Chris@16
|
33 // ++a;
|
Chris@16
|
34 //
|
Chris@16
|
35 // Effects: Atomically increments the value of a
|
Chris@16
|
36 // Returns: (long) the new value of a
|
Chris@101
|
37 // Memory Ordering: acquire/release
|
Chris@16
|
38 //
|
Chris@16
|
39 // --a;
|
Chris@16
|
40 //
|
Chris@16
|
41 // Effects: Atomically decrements the value of a
|
Chris@16
|
42 // Returns: (long) the new value of a
|
Chris@101
|
43 // Memory Ordering: acquire/release
|
Chris@16
|
44 //
|
Chris@16
|
45
|
Chris@16
|
46 #include <boost/config.hpp>
|
Chris@16
|
47 #include <boost/smart_ptr/detail/sp_has_sync.hpp>
|
Chris@16
|
48
|
Chris@101
|
49 #if defined( BOOST_AC_DISABLE_THREADS )
|
Chris@101
|
50 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
|
Chris@16
|
51
|
Chris@101
|
52 #elif defined( BOOST_AC_USE_STD_ATOMIC )
|
Chris@101
|
53 # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp>
|
Chris@16
|
54
|
Chris@101
|
55 #elif defined( BOOST_AC_USE_SPINLOCK )
|
Chris@101
|
56 # include <boost/smart_ptr/detail/atomic_count_spin.hpp>
|
Chris@16
|
57
|
Chris@101
|
58 #elif defined( BOOST_AC_USE_PTHREADS )
|
Chris@101
|
59 # include <boost/smart_ptr/detail/atomic_count_pt.hpp>
|
Chris@16
|
60
|
Chris@101
|
61 #elif defined( BOOST_SP_DISABLE_THREADS )
|
Chris@101
|
62 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
|
Chris@16
|
63
|
Chris@101
|
64 #elif defined( BOOST_SP_USE_STD_ATOMIC )
|
Chris@101
|
65 # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp>
|
Chris@16
|
66
|
Chris@101
|
67 #elif defined( BOOST_SP_USE_SPINLOCK )
|
Chris@101
|
68 # include <boost/smart_ptr/detail/atomic_count_spin.hpp>
|
Chris@16
|
69
|
Chris@101
|
70 #elif defined( BOOST_SP_USE_PTHREADS )
|
Chris@101
|
71 # include <boost/smart_ptr/detail/atomic_count_pt.hpp>
|
Chris@101
|
72
|
Chris@101
|
73 #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 )
|
Chris@101
|
74 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
|
Chris@101
|
75
|
Chris@101
|
76 #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ )
|
Chris@101
|
77 # include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp>
|
Chris@101
|
78
|
Chris@101
|
79 #elif defined( BOOST_SP_HAS_SYNC )
|
Chris@101
|
80 # include <boost/smart_ptr/detail/atomic_count_sync.hpp>
|
Chris@16
|
81
|
Chris@16
|
82 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
Chris@101
|
83 # include <boost/smart_ptr/detail/atomic_count_win32.hpp>
|
Chris@16
|
84
|
Chris@16
|
85 #elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
Chris@101
|
86 # include <boost/smart_ptr/detail/atomic_count_gcc.hpp>
|
Chris@16
|
87
|
Chris@101
|
88 #elif !defined( BOOST_HAS_THREADS )
|
Chris@101
|
89 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
|
Chris@16
|
90
|
Chris@16
|
91 #else
|
Chris@101
|
92 # include <boost/smart_ptr/detail/atomic_count_spin.hpp>
|
Chris@16
|
93
|
Chris@16
|
94 #endif
|
Chris@16
|
95
|
Chris@16
|
96 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|