diff options
author | Sven Gothel <[email protected]> | 2015-03-21 23:01:12 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-21 23:01:12 +0100 |
commit | 0c5c4be020c2d55540058a49b2a879f46d5a1e13 (patch) | |
tree | 00f84c2ca18cc233b826014094b9cad0769a3ea5 /LibOVR/Src/Kernel/OVR_Atomic.cpp | |
parent | cbbd775b6c754927632c333ff01424a0d2048c7c (diff) | |
parent | e490c3c7f7bb5461cfa78a214827aa534fb43a3e (diff) |
Merge branch 'vanilla_0.4.4' and resolve conflicts
TODO: Validate for removed patches due to relocation
Resolved Conflicts:
LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp
LibOVR/Src/OVR_Linux_HMDDevice.cpp
LibOVR/Src/OVR_OSX_HMDDevice.cpp
LibOVR/Src/OVR_Profile.cpp
LibOVR/Src/OVR_Sensor2Impl.cpp
LibOVR/Src/OVR_SensorFusion.cpp
LibOVR/Src/OVR_SensorImpl.cpp
LibOVR/Src/OVR_Win32_DeviceStatus.cpp
LibOVR/Src/OVR_Win32_HIDDevice.cpp
LibOVR/Src/OVR_Win32_HIDDevice.h
LibOVR/Src/OVR_Win32_HMDDevice.cpp
Diffstat (limited to 'LibOVR/Src/Kernel/OVR_Atomic.cpp')
-rw-r--r-- | LibOVR/Src/Kernel/OVR_Atomic.cpp | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/LibOVR/Src/Kernel/OVR_Atomic.cpp b/LibOVR/Src/Kernel/OVR_Atomic.cpp index 9ea6e76..f7cf9a6 100644 --- a/LibOVR/Src/Kernel/OVR_Atomic.cpp +++ b/LibOVR/Src/Kernel/OVR_Atomic.cpp @@ -7,16 +7,16 @@ Content : Contains atomic operations and inline fastest locking Created : September 19, 2012 Notes : -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +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.1 +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, @@ -32,7 +32,7 @@ limitations under the License. #ifdef OVR_ENABLE_THREADS // Include Windows 8-Metro compatible Synchronization API -#if defined(OVR_OS_WIN32) && defined(NTDDI_WIN8) && (NTDDI_VERSION >= NTDDI_WIN8) +#if defined(OVR_OS_MS) && defined(NTDDI_WIN8) && (NTDDI_VERSION >= NTDDI_WIN8) #include <synchapi.h> #endif @@ -41,43 +41,20 @@ namespace OVR { // ***** Windows Lock implementation -#if defined(OVR_OS_WIN32) +#if defined(OVR_OS_MS) // ***** Standard Win32 Lock implementation // Constructors Lock::Lock(unsigned spinCount) { -#if defined(NTDDI_WIN8) && (NTDDI_VERSION >= NTDDI_WIN8) - // On Windows 8 we use InitializeCriticalSectionEx due to Metro-Compatibility - InitializeCriticalSectionEx(&cs, spinCount, - OVR_DEBUG_SELECT(NULL, CRITICAL_SECTION_NO_DEBUG_INFO)); -#else - // Spin count init critical section function prototype for Window NT - typedef BOOL (WINAPI *Function_InitializeCriticalSectionAndSpinCount) - (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount); - - - // Try to load function dynamically so that we don't require NT - // On Windows NT we will use InitializeCriticalSectionAndSpinCount - static bool initTried = 0; - static Function_InitializeCriticalSectionAndSpinCount pInitFn = 0; - - if (!initTried) - { - HMODULE hmodule = ::LoadLibrary(OVR_STR("kernel32.dll")); - pInitFn = (Function_InitializeCriticalSectionAndSpinCount) - ::GetProcAddress(hmodule, "InitializeCriticalSectionAndSpinCount"); - initTried = true; - } - - // Initialize the critical section - if (pInitFn) - pInitFn(&cs, spinCount); - else - ::InitializeCriticalSection(&cs); -#endif - + #if defined(NTDDI_WIN8) && (NTDDI_VERSION >= NTDDI_WIN8) + // On Windows 8 we use InitializeCriticalSectionEx due to Metro-Compatibility + InitializeCriticalSectionEx(&cs, (DWORD)spinCount, + OVR_DEBUG_SELECT(NULL, CRITICAL_SECTION_NO_DEBUG_INFO)); + #else + ::InitializeCriticalSectionAndSpinCount(&cs, (DWORD)spinCount); // This is available with WindowsXP+. + #endif } @@ -107,7 +84,7 @@ Lock* SharedLock::GetLockAddRef() do { oldUseCount = UseCount; - if (oldUseCount == LockInitMarker) + if (oldUseCount == (int)LockInitMarker) continue; if (oldUseCount == 0) @@ -137,7 +114,7 @@ void SharedLock::ReleaseLock(Lock* plock) do { oldUseCount = UseCount; - OVR_ASSERT(oldUseCount != LockInitMarker); + OVR_ASSERT(oldUseCount != (int)LockInitMarker); if (oldUseCount == 1) { |