summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/SWmain.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-05-14 12:33:19 -0400
committerLioncash <mathew1800@gmail.com>2015-05-14 12:33:19 -0400
commit26a3eaf95906b047170a6871371fb6201d90d81b (patch)
tree2d724a6931c61455d13bf9ea21ac5316db8fd13d /Source/Core/VideoBackends/Software/SWmain.cpp
parent8290fa1e462236115772b7498fe8032792a3ee5c (diff)
Software: Convert most volatile variables to atomics
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWmain.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/SWmain.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp
index 784fe6d07b..1b35e0dde3 100644
--- a/Source/Core/VideoBackends/Software/SWmain.cpp
+++ b/Source/Core/VideoBackends/Software/SWmain.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <atomic>
#include <string>
-#include "Common/Atomic.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/StringUtil.h"
@@ -41,7 +41,7 @@
#define VSYNC_ENABLED 0
-static volatile u32 s_swapRequested = false;
+static std::atomic<bool> s_swapRequested;
static volatile struct
{
@@ -53,8 +53,8 @@ static volatile struct
namespace SW
{
-static volatile bool fifoStateRun = false;
-static volatile bool emuRunningState = false;
+static std::atomic<bool> fifoStateRun;
+static std::atomic<bool> emuRunningState;
static std::mutex m_csSWVidOccupied;
std::string VideoSoftware::GetName() const
@@ -144,12 +144,12 @@ void VideoSoftware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
void VideoSoftware::RunLoop(bool enable)
{
- emuRunningState = enable;
+ emuRunningState.store(enable);
}
void VideoSoftware::EmuStateChange(EMUSTATE_CHANGE newState)
{
- emuRunningState = (newState == EMUSTATE_CHANGE_PLAY) ? true : false;
+ emuRunningState.store(newState == EMUSTATE_CHANGE_PLAY);
}
void VideoSoftware::Shutdown()
@@ -243,7 +243,7 @@ void VideoSoftware::Video_EndField()
// If we are in dual core mode, notify the GPU thread about the new color texture.
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread)
- Common::AtomicStoreRelease(s_swapRequested, true);
+ s_swapRequested.store(true);
else
SWRenderer::Swap(s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight);
}
@@ -300,10 +300,10 @@ bool VideoSoftware::Video_Screenshot(const std::string& filename)
// Run from the graphics thread
static void VideoFifo_CheckSwapRequest()
{
- if (Common::AtomicLoadAcquire(s_swapRequested))
+ if (s_swapRequested.load())
{
SWRenderer::Swap(s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight);
- Common::AtomicStoreRelease(s_swapRequested, false);
+ s_swapRequested.store(false);
}
}
@@ -313,9 +313,9 @@ static void VideoFifo_CheckSwapRequest()
void VideoSoftware::Video_EnterLoop()
{
std::lock_guard<std::mutex> lk(m_csSWVidOccupied);
- fifoStateRun = true;
+ fifoStateRun.store(true);
- while (fifoStateRun)
+ while (fifoStateRun.load())
{
VideoFifo_CheckSwapRequest();
g_video_backend->PeekMessages();
@@ -325,7 +325,7 @@ void VideoSoftware::Video_EnterLoop()
Common::YieldCPU();
}
- while (!emuRunningState && fifoStateRun)
+ while (!emuRunningState.load() && fifoStateRun.load())
{
g_video_backend->PeekMessages();
VideoFifo_CheckSwapRequest();
@@ -338,7 +338,7 @@ void VideoSoftware::Video_EnterLoop()
void VideoSoftware::Video_ExitLoop()
{
- fifoStateRun = false;
+ fifoStateRun.store(false);
}
// TODO : could use the OSD class in video common, we would need to implement the Renderer class