Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeliyaal <beliyaal@users.sourceforge.net>2009-10-28 00:31:46 +0300
committerbeliyaal <beliyaal@users.sourceforge.net>2009-10-28 00:31:46 +0300
commitf269e5b9fb3c3db8a1398f87a7062da406fdf30b (patch)
tree7eeabde3e2ae21ed2cf29b0d299c7fe71e4e05cc /src/filters/BaseClasses/wxutil.cpp
parent7d6aecccb36aa9d11ed8b485b0770f2679443dc5 (diff)
Fixed: Scanline and refresh rate detection algorithm changed
Fixed: Scanline detection and sync was incorrect on rotated displays Fixed: D3D device interference from other threads minimized Added: TryLock added to CCritSec git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1312 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/BaseClasses/wxutil.cpp')
-rw-r--r--src/filters/BaseClasses/wxutil.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/filters/BaseClasses/wxutil.cpp b/src/filters/BaseClasses/wxutil.cpp
index 5bc97a9ae..9e84cd338 100644
--- a/src/filters/BaseClasses/wxutil.cpp
+++ b/src/filters/BaseClasses/wxutil.cpp
@@ -508,6 +508,26 @@ void CCritSec::Lock()
}
}
+bool CCritSec::TryLock()
+{
+ UINT tracelevel=3;
+ DWORD us = GetCurrentThreadId();
+ DWORD currentOwner = m_currentOwner;
+ BOOL bSuccess = TryEnterCriticalSection(&m_CritSec);
+ if (bSuccess)
+ {
+ if (0 == m_lockCount++) {
+ // we now own it for the first time. Set owner information
+ m_currentOwner = us;
+
+ if (m_fTrace) {
+ DbgLog((LOG_LOCKING, tracelevel, TEXT("Thread %d now owns lock %x"), m_currentOwner, &m_CritSec));
+ }
+ }
+ }
+ return bSuccess != 0;
+}
+
void CCritSec::Unlock() {
if (0 == --m_lockCount) {
// about to be unowned