mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
18 lines
410 B
C++
18 lines
410 B
C++
#if defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
|
|
|
|
#include "gcc_atomic.h"
|
|
#include <bits/atomicity.h>
|
|
|
|
int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr)
|
|
{
|
|
return __gnu_cxx::__exchange_and_add(ptr, -1) - 1;
|
|
}
|
|
|
|
int _msgpack_sync_incr_and_fetch(volatile _msgpack_atomic_counter_t* ptr)
|
|
{
|
|
return __gnu_cxx::__exchange_and_add(ptr, 1) + 1;
|
|
}
|
|
|
|
|
|
#endif // old gcc workaround
|