summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/SWCommandProcessor.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/SWCommandProcessor.cpp
parent8290fa1e462236115772b7498fe8032792a3ee5c (diff)
Software: Convert most volatile variables to atomics
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/SWCommandProcessor.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp
index 9c7ff303b7..39f772894e 100644
--- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp
+++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <atomic>
#include "Common/Atomic.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
@@ -41,8 +42,8 @@ static u8 commandBuffer[commandBufferSize];
static u32 readPos;
static u32 writePos;
static int et_UpdateInterrupts;
-static volatile bool interruptSet;
-static volatile bool interruptWaiting;
+static std::atomic<bool> interruptSet;
+static std::atomic<bool> interruptWaiting;
static CPReg cpreg; // shared between gfx and emulator thread
@@ -92,8 +93,8 @@ void Init()
readPos = 0;
writePos = 0;
- interruptSet = false;
- interruptWaiting = false;
+ interruptSet.store(false);
+ interruptWaiting.store(false);
g_video_buffer_read_ptr = nullptr;
g_bSkipCurrentFrame = false;
@@ -195,17 +196,17 @@ void UpdateInterrupts(u64 userdata)
{
if (userdata)
{
- interruptSet = true;
+ interruptSet.store(true);
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
}
else
{
- interruptSet = false;
+ interruptSet.store(false);
INFO_LOG(COMMANDPROCESSOR,"Interrupt cleared");
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false);
}
- interruptWaiting = false;
+ interruptWaiting.store(false);
}
void UpdateInterruptsFromVideoBackend(u64 userdata)
@@ -285,12 +286,12 @@ static void SetStatus()
bool interrupt = bpInt || ovfInt || undfInt;
- if (interrupt != interruptSet && !interruptWaiting)
+ if (interrupt != interruptSet.load() && !interruptWaiting.load())
{
u64 userdata = interrupt?1:0;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread)
{
- interruptWaiting = true;
+ interruptWaiting.store(true);
SWCommandProcessor::UpdateInterruptsFromVideoBackend(userdata);
}
else