summaryrefslogtreecommitdiff
path: root/source/Utility/SharingPtr.cpp
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2013-11-06 16:48:53 +0000
committerEd Maste <emaste@FreeBSD.org>2013-11-06 16:48:53 +0000
commitf21a844f60ae6c74fcf1fddca32461acce3c1ee0 (patch)
tree56d79f94966870db1cecd65a7264510a25fd1cba /source/Utility/SharingPtr.cpp
parent37d22554be9f5a677dad2a95b7ef22fe59c66a8a (diff)
Notes
Diffstat (limited to 'source/Utility/SharingPtr.cpp')
-rw-r--r--source/Utility/SharingPtr.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/Utility/SharingPtr.cpp b/source/Utility/SharingPtr.cpp
index f64d7e3995b82..be237cec61c40 100644
--- a/source/Utility/SharingPtr.cpp
+++ b/source/Utility/SharingPtr.cpp
@@ -138,13 +138,21 @@ namespace imp
void
shared_count::add_shared()
{
- increment(shared_owners_);
+#ifdef _MSC_VER
+ _InterlockedIncrement(&shared_owners_);
+#else
+ ++shared_owners_;
+#endif
}
void
shared_count::release_shared()
{
- if (decrement(shared_owners_) == -1)
+#ifdef _MSC_VER
+ if (_InterlockedDecrement(&shared_owners_) == -1)
+#else
+ if (--shared_owners_ == -1)
+#endif
{
on_zero_shared();
delete this;