diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip
index 12e24f962..0060ceb90 100644
--- a/ext/installfiles/windows/ZeroTier One.aip
+++ b/ext/installfiles/windows/ZeroTier One.aip
@@ -13,7 +13,6 @@
-
@@ -21,6 +20,7 @@
+
@@ -35,15 +35,13 @@
-
-
-
+
@@ -51,22 +49,22 @@
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
@@ -74,14 +72,14 @@
-
+
-
+
@@ -92,7 +90,6 @@
-
@@ -114,7 +111,7 @@
-
+
@@ -129,9 +126,18 @@
+
+
+
+
+
+
+
+
+
@@ -168,10 +174,13 @@
+
+
+
@@ -184,6 +193,12 @@
+
+
+
+
+
+
@@ -199,6 +214,10 @@
+
+
+
+
@@ -227,7 +246,7 @@
-
+
@@ -236,4 +255,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node/AtomicCounter.hpp b/node/AtomicCounter.hpp
index c801e56e3..9dc5fd05e 100644
--- a/node/AtomicCounter.hpp
+++ b/node/AtomicCounter.hpp
@@ -28,9 +28,15 @@
#ifndef ZT_ATOMICCOUNTER_HPP
#define ZT_ATOMICCOUNTER_HPP
+#include "Constants.hpp"
#include "Mutex.hpp"
#include "NonCopyable.hpp"
+#ifdef __WINDOWS__
+// will replace this whole class eventually once it's ubiquitous
+#include
+#endif
+
namespace ZeroTier {
/**
@@ -43,21 +49,25 @@ public:
* Initialize counter at zero
*/
AtomicCounter()
- throw() :
- _v(0)
+ throw()
{
+ _v = 0;
}
- inline int operator*() const
+ inline operator int() const
throw()
{
#ifdef __GNUC__
- return __sync_or_and_fetch(const_cast (&_v),0);
+ return __sync_or_and_fetch(&_v,0);
+#else
+#ifdef __WINDOWS__
+ return (int)_v;
#else
_l.lock();
int v = _v;
_l.unlock();
return v;
+#endif
#endif
}
@@ -66,11 +76,15 @@ public:
{
#ifdef __GNUC__
return __sync_add_and_fetch(&_v,1);
+#else
+#ifdef __WINDOWS__
+ return ++_v;
#else
_l.lock();
int v = ++_v;
_l.unlock();
return v;
+#endif
#endif
}
@@ -79,33 +93,27 @@ public:
{
#ifdef __GNUC__
return __sync_sub_and_fetch(&_v,1);
+#else
+#ifdef __WINDOWS__
+ return --_v;
#else
_l.lock();
int v = --_v;
_l.unlock();
return v;
+#endif
#endif
}
- inline bool operator==(const AtomicCounter &i) const throw() { return (**this == *i); }
- inline bool operator!=(const AtomicCounter &i) const throw() { return (**this != *i); }
- inline bool operator>(const AtomicCounter &i) const throw() { return (**this > *i); }
- inline bool operator<(const AtomicCounter &i) const throw() { return (**this < *i); }
- inline bool operator>=(const AtomicCounter &i) const throw() { return (**this >= *i); }
- inline bool operator<=(const AtomicCounter &i) const throw() { return (**this <= *i); }
-
- inline bool operator==(const int i) const throw() { return (**this == i); }
- inline bool operator!=(const int i) const throw() { return (**this != i); }
- inline bool operator>(const int i) const throw() { return (**this > i); }
- inline bool operator<(const int i) const throw() { return (**this < i); }
- inline bool operator>=(const int i) const throw() { return (**this >= i); }
- inline bool operator<=(const int i) const throw() { return (**this <= i); }
-
private:
+#ifdef __WINDOWS__
+ std::atomic_int _v;
+#else
int _v;
#ifndef __GNUC__
Mutex _l;
#endif
+#endif
};
} // namespace ZeroTier