This commit is contained in:
Adam Ierymenko 2019-08-23 12:40:08 -07:00
parent b727e2a67a
commit f12370c348
No known key found for this signature in database
GPG key ID: 1657198823E52A61
4 changed files with 82 additions and 82 deletions

View file

@ -28,9 +28,9 @@ namespace ZeroTier {
class AtomicCounter
{
public:
inline AtomicCounter() { _v = 0; }
ZT_ALWAYS_INLINE AtomicCounter() { _v = 0; }
inline int load() const
ZT_ALWAYS_INLINE int load() const
{
#ifdef __GNUC__
return __sync_or_and_fetch(const_cast<int *>(&_v),0);
@ -39,7 +39,7 @@ public:
#endif
}
inline int operator++()
ZT_ALWAYS_INLINE int operator++()
{
#ifdef __GNUC__
return __sync_add_and_fetch(&_v,1);
@ -48,7 +48,7 @@ public:
#endif
}
inline int operator--()
ZT_ALWAYS_INLINE int operator--()
{
#ifdef __GNUC__
return __sync_sub_and_fetch(&_v,1);