gsdx: use standard lock_guard instead of GSAutoLock

This commit is contained in:
Gregory Hainaut 2015-03-03 18:29:21 +01:00
parent 9ad5933120
commit a75d78bd7e
6 changed files with 32 additions and 0 deletions

View File

@ -853,7 +853,11 @@ EXPORT_C GSgetTitleInfo2(char* dest, size_t length)
if(s_gs->m_GStitleInfoBuffer[0]) if(s_gs->m_GStitleInfoBuffer[0])
{ {
#ifdef _CX11_
std::lock_guard<std::mutex> lock(s_gs->m_pGSsetTitle_Crit);
#else
GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit); GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit);
#endif
s = format("GSdx | %s", s_gs->m_GStitleInfoBuffer); s = format("GSdx | %s", s_gs->m_GStitleInfoBuffer);

View File

@ -386,7 +386,11 @@ GSCapture::~GSCapture()
bool GSCapture::BeginCapture(float fps) bool GSCapture::BeginCapture(float fps)
{ {
#ifdef _CX11_
std::lock_guard<std::mutex> lock(m_lock);
#else
GSAutoLock lock(&m_lock); GSAutoLock lock(&m_lock);
#endif
ASSERT(fps != 0); ASSERT(fps != 0);
@ -481,7 +485,11 @@ bool GSCapture::BeginCapture(float fps)
bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba) bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba)
{ {
#ifdef _CX11_
std::lock_guard<std::mutex> lock(m_lock);
#else
GSAutoLock lock(&m_lock); GSAutoLock lock(&m_lock);
#endif
if(bits == NULL || pitch == 0) if(bits == NULL || pitch == 0)
{ {
@ -506,7 +514,11 @@ bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba)
bool GSCapture::EndCapture() bool GSCapture::EndCapture()
{ {
#ifdef _CX11_
std::lock_guard<std::mutex> lock(m_lock);
#else
GSAutoLock lock(&m_lock); GSAutoLock lock(&m_lock);
#endif
#ifdef _WINDOWS #ifdef _WINDOWS

View File

@ -22,7 +22,9 @@
#pragma once #pragma once
#include "GSVector.h" #include "GSVector.h"
#ifndef _CX11_
#include "GSThread.h" #include "GSThread.h"
#endif
#ifdef _WINDOWS #ifdef _WINDOWS
#include "GSCaptureDlg.h" #include "GSCaptureDlg.h"
@ -30,7 +32,11 @@
class GSCapture class GSCapture
{ {
#ifdef _CX11_
std::mutex m_lock;
#else
GSCritSec m_lock; GSCritSec m_lock;
#endif
bool m_capturing; bool m_capturing;
GSVector2i m_size; GSVector2i m_size;

View File

@ -26,7 +26,9 @@
#include "GSVector.h" #include "GSVector.h"
#include "GSBlock.h" #include "GSBlock.h"
#include "GSClut.h" #include "GSClut.h"
#ifndef _CX11_
#include "GSThread.h" #include "GSThread.h"
#endif
class GSOffset : public GSAlignedClass<32> class GSOffset : public GSAlignedClass<32>
{ {

View File

@ -406,7 +406,11 @@ void GSRenderer::VSync(int field)
// be noticeable). Besides, these locks are extremely short -- overhead of conditional // 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 // is way more expensive than just waiting for the CriticalSection in 1 of 10,000,000 tries. --air
#ifdef _CX11_
std::lock_guard<std::mutex> lock(m_pGSsetTitle_Crit);
#else
GSAutoLock lock(&m_pGSsetTitle_Crit); GSAutoLock lock(&m_pGSsetTitle_Crit);
#endif
strncpy(m_GStitleInfoBuffer, s.c_str(), countof(m_GStitleInfoBuffer) - 1); strncpy(m_GStitleInfoBuffer, s.c_str(), countof(m_GStitleInfoBuffer) - 1);

View File

@ -78,7 +78,11 @@ public:
virtual void EndCapture(); virtual void EndCapture();
public: public:
#ifdef _CX11_
std::mutex m_pGSsetTitle_Crit;
#else
GSCritSec m_pGSsetTitle_Crit; GSCritSec m_pGSsetTitle_Crit;
#endif
char m_GStitleInfoBuffer[128]; char m_GStitleInfoBuffer[128];
}; };