summaryrefslogtreecommitdiff
path: root/core/safe_refcount.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-07-11 09:27:48 -0300
committerGitHub <noreply@github.com>2017-07-11 09:27:48 -0300
commit98a9c8fc5f6590e8233e766ec05dab527d5343ac (patch)
tree2606905904957cca602c76ae6581a6b9691dffc3 /core/safe_refcount.cpp
parent6758ba0d933a4f83e246b500639cbb99f0f0cacd (diff)
parent711ebafa710f9097d6e0d3dbfb5f4b39f6283701 (diff)
Merge pull request #9604 from godotengine/revert-9014-improve-mem-stats
Revert "Improve reliability of memory stats"
Diffstat (limited to 'core/safe_refcount.cpp')
-rw-r--r--core/safe_refcount.cpp67
1 files changed, 0 insertions, 67 deletions
diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp
index 95a274cda7..e4a5a994e6 100644
--- a/core/safe_refcount.cpp
+++ b/core/safe_refcount.cpp
@@ -57,30 +57,6 @@ uint32_t atomic_decrement(register uint32_t *pw) {
return *pw;
}
-uint64_t atomic_conditional_increment(register uint64_t *pw) {
-
- if (*pw == 0)
- return 0;
-
- (*pw)++;
-
- return *pw;
-}
-
-uint64_t atomic_increment(register uint64_t *pw) {
-
- (*pw)++;
-
- return *pw;
-}
-
-uint64_t atomic_decrement(register uint64_t *pw) {
-
- (*pw)--;
-
- return *pw;
-}
-
#else
#ifdef _MSC_VER
@@ -108,28 +84,6 @@ uint32_t atomic_decrement(register uint32_t *pw) {
uint32_t atomic_increment(register uint32_t *pw) {
return InterlockedIncrement((LONG volatile *)pw);
}
-
-uint64_t atomic_conditional_increment(register uint64_t *pw) {
-
- /* try to increment until it actually works */
- // taken from boost
-
- while (true) {
- uint64_t tmp = static_cast<uint64_t const volatile &>(*pw);
- if (tmp == 0)
- return 0; // if zero, can't add to it anymore
- if (InterlockedCompareExchange64((LONGLONG volatile *)pw, tmp + 1, tmp) == tmp)
- return tmp + 1;
- }
-}
-
-uint64_t atomic_decrement(register uint64_t *pw) {
- return InterlockedDecrement64((LONGLONG volatile *)pw);
-}
-
-uint64_t atomic_increment(register uint64_t *pw) {
- return InterlockedIncrement64((LONGLONG volatile *)pw);
-}
#elif defined(__GNUC__)
uint32_t atomic_conditional_increment(register uint32_t *pw) {
@@ -153,27 +107,6 @@ uint32_t atomic_increment(register uint32_t *pw) {
return __sync_add_and_fetch(pw, 1);
}
-uint64_t atomic_conditional_increment(register uint64_t *pw) {
-
- while (true) {
- uint64_t tmp = static_cast<uint64_t const volatile &>(*pw);
- if (tmp == 0)
- return 0; // if zero, can't add to it anymore
- if (__sync_val_compare_and_swap(pw, tmp, tmp + 1) == tmp)
- return tmp + 1;
- }
-}
-
-uint64_t atomic_decrement(register uint64_t *pw) {
-
- return __sync_sub_and_fetch(pw, 1);
-}
-
-uint64_t atomic_increment(register uint64_t *pw) {
-
- return __sync_add_and_fetch(pw, 1);
-}
-
#else
//no threads supported?
#error Must provide atomic functions for this platform or compiler!