diff options
author | Sven Gothel <[email protected]> | 2015-03-28 01:43:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-28 01:43:35 +0100 |
commit | 4207f9c279e832e3afcb3f5fc6cd8d84cb4cfe4c (patch) | |
tree | cf3671058d55b47ab6cb6f36f369928606137628 /LibOVR/Src/Kernel/OVR_RefCount.cpp | |
parent | c29cd1a2fbff6282bab956ad61661ac9d48c4e6e (diff) |
Bump OculusVR RIFT SDK to 0.5.0.1vanilla_0.5.0.1
Diffstat (limited to 'LibOVR/Src/Kernel/OVR_RefCount.cpp')
-rw-r--r-- | LibOVR/Src/Kernel/OVR_RefCount.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/LibOVR/Src/Kernel/OVR_RefCount.cpp b/LibOVR/Src/Kernel/OVR_RefCount.cpp deleted file mode 100644 index f761811..0000000 --- a/LibOVR/Src/Kernel/OVR_RefCount.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************************ - -Filename : OVR_RefCount.cpp -Content : Reference counting implementation -Created : September 19, 2012 -Notes : - -Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. - -Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); -you may not use the Oculus VR Rift SDK except in compliance with the License, -which is provided at the time of installation or download, or which -otherwise accompanies this software in either electronic or hard copy form. - -You may obtain a copy of the License at - -http://www.oculusvr.com/licenses/LICENSE-3.2 - -Unless required by applicable law or agreed to in writing, the Oculus VR SDK -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -************************************************************************************/ - -#include "OVR_RefCount.h" -#include "OVR_Atomic.h" -#include "OVR_Log.h" - -namespace OVR { - -#ifdef OVR_CC_ARM -void* ReturnArg0(void* p) -{ - return p; -} -#endif - -// ***** Reference Count Base implementation - -RefCountImplCore::~RefCountImplCore() -{ - // RefCount can be either 1 or 0 here. - // 0 if Release() was properly called. - // 1 if the object was declared on stack or as an aggregate. - OVR_ASSERT(RefCount <= 1); -} - -#ifdef OVR_BUILD_DEBUG -void RefCountImplCore::reportInvalidDelete(void *pmem) -{ - OVR_DEBUG_LOG( - ("Invalid delete call on ref-counted object at %p. Please use Release()", pmem)); - OVR_ASSERT(0); -} -#endif - -RefCountNTSImplCore::~RefCountNTSImplCore() -{ - // RefCount can be either 1 or 0 here. - // 0 if Release() was properly called. - // 1 if the object was declared on stack or as an aggregate. - OVR_ASSERT(RefCount <= 1); -} - -#ifdef OVR_BUILD_DEBUG -void RefCountNTSImplCore::reportInvalidDelete(void *pmem) -{ - OVR_DEBUG_LOG( - ("Invalid delete call on ref-counted object at %p. Please use Release()", pmem)); - OVR_ASSERT(0); -} -#endif - - -// *** Thread-Safe RefCountImpl - -void RefCountImpl::AddRef() -{ - AtomicOps<int>::ExchangeAdd_NoSync(&RefCount, 1); -} -void RefCountImpl::Release() -{ - if ((AtomicOps<int>::ExchangeAdd_NoSync(&RefCount, -1) - 1) == 0) - delete this; -} - -// *** Thread-Safe RefCountVImpl w/virtual AddRef/Release - -void RefCountVImpl::AddRef() -{ - AtomicOps<int>::ExchangeAdd_NoSync(&RefCount, 1); -} -void RefCountVImpl::Release() -{ - if ((AtomicOps<int>::ExchangeAdd_NoSync(&RefCount, -1) - 1) == 0) - delete this; -} - -// *** NON-Thread-Safe RefCountImpl - -void RefCountNTSImpl::Release() const -{ - RefCount--; - if (RefCount == 0) - delete this; -} - - -} // OVR |