1 | #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED |
2 | #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED |
3 | |
4 | // |
5 | // boost/detail/atomic_count_nt.hpp |
6 | // |
7 | // Trivial atomic_count for the single-threaded case |
8 | // |
9 | // http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html |
10 | // |
11 | // Copyright 2013 Peter Dimov |
12 | // |
13 | // Distributed under the Boost Software License, Version 1.0. |
14 | // See accompanying file LICENSE_1_0.txt or copy at |
15 | // http://www.boost.org/LICENSE_1_0.txt |
16 | // |
17 | |
18 | namespace boost |
19 | { |
20 | |
21 | namespace detail |
22 | { |
23 | |
24 | class atomic_count |
25 | { |
26 | public: |
27 | |
28 | explicit atomic_count( long v ): value_( v ) |
29 | { |
30 | } |
31 | |
32 | long operator++() |
33 | { |
34 | return ++value_; |
35 | } |
36 | |
37 | long operator--() |
38 | { |
39 | return --value_; |
40 | } |
41 | |
42 | operator long() const |
43 | { |
44 | return value_; |
45 | } |
46 | |
47 | private: |
48 | |
49 | atomic_count(atomic_count const &); |
50 | atomic_count & operator=(atomic_count const &); |
51 | |
52 | long value_; |
53 | }; |
54 | |
55 | } // namespace detail |
56 | |
57 | } // namespace boost |
58 | |
59 | #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED |
60 | |