Remove volatile from Atomic parameter declarations

* This was leaky from windows' InterlockedIncrement etc declarations, and is not
  necessary.
This commit is contained in:
baldurk
2020-09-09 13:12:56 +01:00
parent 3f26f42541
commit 78f1f8f3d1
18 changed files with 44 additions and 44 deletions
+1 -1
View File
@@ -1124,7 +1124,7 @@ ExecuteResult AndroidRemoteServer::ExecuteAndInject(const char *a, const char *w
rdcstr intentArgs = c && c[0] ? c : "";
// we spin up a thread to Ping() every second, since starting a package can block for a long time.
volatile int32_t done = 0;
int32_t done = 0;
Threading::ThreadHandle pingThread = Threading::CreateThread([&done, this]() {
Threading::SetCurrentThreadName("Android Ping");
+1 -1
View File
@@ -79,7 +79,7 @@ public:
bool Trylock() { return Atomic::CmpExch32(&val, 0, 1) == 0; }
void Unlock() { Atomic::CmpExch32(&val, 1, 0); }
private:
volatile int32_t val = 0;
int32_t val = 0;
};
class ScopedSpinLock
+2 -2
View File
@@ -696,8 +696,8 @@ private:
RemoteExecution_ThreadActive = 2,
};
volatile int32_t m_RemoteExecutionKill = 0;
volatile int32_t m_RemoteExecutionState = RemoteExecution_Inactive;
int32_t m_RemoteExecutionKill = 0;
int32_t m_RemoteExecutionState = RemoteExecution_Inactive;
bool IsThreadIdle()
{
+1 -1
View File
@@ -29,7 +29,7 @@
namespace ResourceIDGen
{
static volatile int64_t globalIDCounter = 1;
static int64_t globalIDCounter = 1;
ResourceId GetNewUniqueID()
{
+2 -2
View File
@@ -493,7 +493,7 @@ struct ResourceRecord
bool DataWritten;
protected:
volatile int32_t RefCount;
int32_t RefCount;
byte *DataPtr;
uint64_t DataOffset;
@@ -504,7 +504,7 @@ protected:
int64_t GetID()
{
static volatile int64_t globalIDCounter = 10;
static int64_t globalIDCounter = 10;
return Atomic::Inc64(&globalIDCounter);
}
+1 -1
View File
@@ -38,7 +38,7 @@ public:
WrappedOpenGL driver;
std::set<CGLContextObj> contexts;
volatile int32_t suppressed = 0;
int32_t suppressed = 0;
} cglhook;
CGLError GL_EXPORT_NAME(CGLCreateContext)(CGLPixelFormatObj pix, CGLContextObj share,
+1 -1
View File
@@ -346,7 +346,7 @@ private:
std::map<GLsync, ResourceId> m_SyncIDs;
std::map<GLuint, GLsync> m_CurrentSyncs;
std::map<ResourceId, rdcstr> m_Names;
volatile int64_t m_SyncName;
int64_t m_SyncName;
struct FBOCache
{
+2 -2
View File
@@ -294,7 +294,7 @@ private:
CaptureState m_State;
bool m_AppControlledCapture = false;
volatile int32_t m_ReuseEnabled = 1;
int32_t m_ReuseEnabled = 1;
PerformanceTimer m_CaptureTimer;
@@ -761,7 +761,7 @@ private:
rdcarray<VkResourceRecord *> m_ForcedReferences;
Threading::CriticalSection m_ForcedReferencesLock;
volatile int64_t m_QueueCounter = 0;
int64_t m_QueueCounter = 0;
rdcarray<VkResourceRecord *> GetForcedReferences()
{
+1 -1
View File
@@ -500,7 +500,7 @@ TEST_CASE("Test OS-specific functions", "[osspecific]")
SECTION("Atomics")
{
volatile int32_t value = 0;
int32_t value = 0;
// check that thread atomics work on multiple overlapping threads
Threading::ThreadHandle threads[numThreads];
+6 -6
View File
@@ -224,12 +224,12 @@ void Shutdown();
namespace Atomic
{
int32_t Inc32(volatile int32_t *i);
int32_t Dec32(volatile int32_t *i);
int64_t Inc64(volatile int64_t *i);
int64_t Dec64(volatile int64_t *i);
int64_t ExchAdd64(volatile int64_t *i, int64_t a);
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal);
int32_t Inc32(int32_t *i);
int32_t Dec32(int32_t *i);
int64_t Inc64(int64_t *i);
int64_t Dec64(int64_t *i);
int64_t ExchAdd64(int64_t *i, int64_t a);
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal);
};
namespace Callstack
+1 -1
View File
@@ -51,7 +51,7 @@ DLOPENPROC realdlopen = NULL;
FORKPROC realfork = NULL;
DLSYMPROC realdlsym = NULL;
static volatile int32_t tlsbusyflag = 0;
static int32_t tlsbusyflag = 0;
__attribute__((visibility("default"))) void *dlopen(const char *filename, int flag)
{
+6 -6
View File
@@ -41,32 +41,32 @@ time_t Timing::GetUTCTime()
namespace Atomic
{
int32_t Inc32(volatile int32_t *i)
int32_t Inc32(int32_t *i)
{
return __sync_add_and_fetch(i, int32_t(1));
}
int32_t Dec32(volatile int32_t *i)
int32_t Dec32(int32_t *i)
{
return __sync_add_and_fetch(i, int32_t(-1));
}
int64_t Inc64(volatile int64_t *i)
int64_t Inc64(int64_t *i)
{
return __sync_add_and_fetch(i, int64_t(1));
}
int64_t Dec64(volatile int64_t *i)
int64_t Dec64(int64_t *i)
{
return __sync_add_and_fetch(i, int64_t(-1));
}
int64_t ExchAdd64(volatile int64_t *i, int64_t a)
int64_t ExchAdd64(int64_t *i, int64_t a)
{
return __sync_add_and_fetch(i, int64_t(a));
}
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal)
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal)
{
return __sync_val_compare_and_swap(dest, oldVal, newVal);
}
+1 -1
View File
@@ -164,7 +164,7 @@ struct CachedHookData
bool missedOrdinals;
volatile int32_t posthooking = 0;
int32_t posthooking = 0;
void ApplyHooks(const char *modName, HMODULE module)
{
+1 -1
View File
@@ -1135,7 +1135,7 @@ struct GlobalHookData
rdcwstr appinitDLLs;
} dataNative, dataWow32;
volatile int32_t finished = 0;
int32_t finished = 0;
Threading::ThreadHandle pipeThread = 0;
};
+6 -6
View File
@@ -54,32 +54,32 @@ time_t Timing::GetUTCTime()
namespace Atomic
{
int32_t Inc32(volatile int32_t *i)
int32_t Inc32(int32_t *i)
{
return (int32_t)InterlockedIncrement((volatile LONG *)i);
}
int32_t Dec32(volatile int32_t *i)
int32_t Dec32(int32_t *i)
{
return (int32_t)InterlockedDecrement((volatile LONG *)i);
}
int64_t Inc64(volatile int64_t *i)
int64_t Inc64(int64_t *i)
{
return (int64_t)InterlockedIncrement64((volatile LONG64 *)i);
}
int64_t Dec64(volatile int64_t *i)
int64_t Dec64(int64_t *i)
{
return (int64_t)InterlockedDecrement64((volatile LONG64 *)i);
}
int64_t ExchAdd64(volatile int64_t *i, int64_t a)
int64_t ExchAdd64(int64_t *i, int64_t a)
{
return (int64_t)InterlockedExchangeAdd64((volatile LONG64 *)i, a);
}
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal)
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal)
{
return (int32_t)InterlockedCompareExchange((volatile LONG *)dest, newVal, oldVal);
}
+8 -8
View File
@@ -37,14 +37,14 @@
#include "catch/catch.hpp"
static volatile int32_t constructor = 0;
static volatile int32_t moveConstructor = 0;
static volatile int32_t valueConstructor = 0;
static volatile int32_t copyConstructor = 0;
static volatile int32_t destructor = 0;
static volatile int32_t movedDestructor = 0;
static volatile int32_t copyAssignment = 0;
static volatile int32_t moveAssignment = 0;
static int32_t constructor = 0;
static int32_t moveConstructor = 0;
static int32_t valueConstructor = 0;
static int32_t copyConstructor = 0;
static int32_t destructor = 0;
static int32_t movedDestructor = 0;
static int32_t copyAssignment = 0;
static int32_t moveAssignment = 0;
struct ConstructorCounter
{
+2 -2
View File
@@ -235,8 +235,8 @@ private:
APIProperties m_APIProps;
rdcarray<rdcstr> m_GCNTargets;
volatile int32_t m_ReplayLoopCancel = 0;
volatile int32_t m_ReplayLoopFinished = 0;
int32_t m_ReplayLoopCancel = 0;
int32_t m_ReplayLoopFinished = 0;
uint32_t m_EventID;
+1 -1
View File
@@ -174,7 +174,7 @@ TEST_CASE("Test stream I/O operations over the network", "[streamio][network]")
rdcarray<uint64_t> list = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597};
// Tracks the lifetime of each thread.
volatile int32_t threadA = 0, threadB = 0;
int32_t threadA = 0, threadB = 0;
Threading::ThreadHandle recvThread =
Threading::CreateThread([&threadA, &reader, &receivedValues]() {