From a75d78bd7e3784ad9aa8bbcd371bd39def29caa7 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 3 Mar 2015 18:29:21 +0100 Subject: [PATCH] gsdx: use standard lock_guard instead of GSAutoLock --- plugins/GSdx/GS.cpp | 4 ++++ plugins/GSdx/GSCapture.cpp | 12 ++++++++++++ plugins/GSdx/GSCapture.h | 6 ++++++ plugins/GSdx/GSLocalMemory.h | 2 ++ plugins/GSdx/GSRenderer.cpp | 4 ++++ plugins/GSdx/GSRenderer.h | 4 ++++ 6 files changed, 32 insertions(+) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 7cca083196..c09fb2596e 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -853,7 +853,11 @@ EXPORT_C GSgetTitleInfo2(char* dest, size_t length) if(s_gs->m_GStitleInfoBuffer[0]) { +#ifdef _CX11_ + std::lock_guard lock(s_gs->m_pGSsetTitle_Crit); +#else GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit); +#endif s = format("GSdx | %s", s_gs->m_GStitleInfoBuffer); diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index 904bfd5a0d..d5c7b34615 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -386,7 +386,11 @@ GSCapture::~GSCapture() bool GSCapture::BeginCapture(float fps) { +#ifdef _CX11_ + std::lock_guard lock(m_lock); +#else GSAutoLock lock(&m_lock); +#endif ASSERT(fps != 0); @@ -481,7 +485,11 @@ bool GSCapture::BeginCapture(float fps) bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba) { +#ifdef _CX11_ + std::lock_guard lock(m_lock); +#else GSAutoLock lock(&m_lock); +#endif if(bits == NULL || pitch == 0) { @@ -506,7 +514,11 @@ bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba) bool GSCapture::EndCapture() { +#ifdef _CX11_ + std::lock_guard lock(m_lock); +#else GSAutoLock lock(&m_lock); +#endif #ifdef _WINDOWS diff --git a/plugins/GSdx/GSCapture.h b/plugins/GSdx/GSCapture.h index eb6e45601c..f6a0d56c0e 100644 --- a/plugins/GSdx/GSCapture.h +++ b/plugins/GSdx/GSCapture.h @@ -22,7 +22,9 @@ #pragma once #include "GSVector.h" +#ifndef _CX11_ #include "GSThread.h" +#endif #ifdef _WINDOWS #include "GSCaptureDlg.h" @@ -30,7 +32,11 @@ class GSCapture { +#ifdef _CX11_ + std::mutex m_lock; +#else GSCritSec m_lock; +#endif bool m_capturing; GSVector2i m_size; diff --git a/plugins/GSdx/GSLocalMemory.h b/plugins/GSdx/GSLocalMemory.h index 70e171090f..591e654369 100644 --- a/plugins/GSdx/GSLocalMemory.h +++ b/plugins/GSdx/GSLocalMemory.h @@ -26,7 +26,9 @@ #include "GSVector.h" #include "GSBlock.h" #include "GSClut.h" +#ifndef _CX11_ #include "GSThread.h" +#endif class GSOffset : public GSAlignedClass<32> { diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 876ba5fea4..eb23a9607d 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -406,7 +406,11 @@ void GSRenderer::VSync(int field) // be noticeable). Besides, these locks are extremely short -- overhead of conditional // is way more expensive than just waiting for the CriticalSection in 1 of 10,000,000 tries. --air +#ifdef _CX11_ + std::lock_guard lock(m_pGSsetTitle_Crit); +#else GSAutoLock lock(&m_pGSsetTitle_Crit); +#endif strncpy(m_GStitleInfoBuffer, s.c_str(), countof(m_GStitleInfoBuffer) - 1); diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 0a68c16c3c..ad4eb22e64 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -78,7 +78,11 @@ public: virtual void EndCapture(); public: +#ifdef _CX11_ + std::mutex m_pGSsetTitle_Crit; +#else GSCritSec m_pGSsetTitle_Crit; +#endif char m_GStitleInfoBuffer[128]; };