MessagePack for C++
gcc_atomic.hpp
Go to the documentation of this file.
1 //
2 // MessagePack for C++ old gcc workaround for atomic operation
3 //
4 // Copyright (C) 2008-2013 FURUHASHI Sadayuki and KONDO Takatoshi
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef MSGPACK_GCC_ATOMIC_HPP
12 #define MSGPACK_GCC_ATOMIC_HPP
13 
14 #if defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
15 
16 #include <bits/atomicity.h>
17 
19 {
20  return __gnu_cxx::__exchange_and_add(ptr, -1) - 1;
21 }
22 
24 {
25  return __gnu_cxx::__exchange_and_add(ptr, 1) + 1;
26 }
27 
28 #endif // old gcc workaround
29 
30 #endif /* gcc_atomic.hpp */
unsigned int _msgpack_atomic_counter_t
Definition: sysdep.hpp:73
#define _msgpack_sync_incr_and_fetch(ptr)
Definition: sysdep.hpp:75
#define _msgpack_sync_decr_and_fetch(ptr)
Definition: sysdep.hpp:74