summaryrefslogtreecommitdiffhomepage
path: root/freetrackclient
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-06-18 18:19:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-06-18 18:48:42 +0200
commite88c7b29ea9ec9fcd6ac6b15c965085152100d2e (patch)
tree6747fe7fa797e024b986ba624d05e6f59032f0ac /freetrackclient
parent646530b5f9ca5debe7a9b4840192e32e43f919bf (diff)
get rid of "volatile" abuse
We heavily used "volatile bool" to check if the thread loop should stop. But this functionality is already provided by Qt5's QThread::requestInterruption. In other cases, "volatile" is wonderfully underspecified so it's better to ditch its usage in favor of std::atomic<t>. At the time we don't appear to be using the "volatile" keyword except when calling win32's Interlocked*() family of functions as necessary. In freetrackclient's header the "volatile" qualifier was used as part of a typedef. This doesn't work. Use it as part of data declaration.
Diffstat (limited to 'freetrackclient')
-rw-r--r--freetrackclient/fttypes.h63
1 files changed, 29 insertions, 34 deletions
diff --git a/freetrackclient/fttypes.h b/freetrackclient/fttypes.h
index 050ffc02..4989a570 100644
--- a/freetrackclient/fttypes.h
+++ b/freetrackclient/fttypes.h
@@ -19,51 +19,46 @@
#pragma once
-#ifndef _MSC_VER
-# include <inttypes.h>
-#else
-typedef unsigned __int32 uint32_t;
-typedef __int32 int32_t;
-#endif
+#include <inttypes.h>
#define FREETRACK_HEAP "FT_SharedMem"
#define FREETRACK_MUTEX "FT_Mutext"
/* only 6 headpose floats and the data id are filled -sh */
-typedef struct __FTData {
- volatile unsigned int DataID;
- volatile int CamWidth;
- volatile int CamHeight;
+typedef struct FTData__ {
+ int32_t DataID;
+ int32_t CamWidth;
+ int32_t CamHeight;
/* virtual pose */
- volatile float Yaw; /* positive yaw to the left */
- volatile float Pitch; /* positive pitch up */
- volatile float Roll; /* positive roll to the left */
- volatile float X;
- volatile float Y;
- volatile float Z;
+ float Yaw; /* positive yaw to the left */
+ float Pitch; /* positive pitch up */
+ float Roll; /* positive roll to the left */
+ float X;
+ float Y;
+ float Z;
/* raw pose with no smoothing, sensitivity, response curve etc. */
- volatile float RawYaw;
- volatile float RawPitch;
- volatile float RawRoll;
- volatile float RawX;
- volatile float RawY;
- volatile float RawZ;
+ float RawYaw;
+ float RawPitch;
+ float RawRoll;
+ float RawX;
+ float RawY;
+ float RawZ;
/* raw points, sorted by Y, origin top left corner */
- volatile float X1;
- volatile float Y1;
- volatile float X2;
- volatile float Y2;
- volatile float X3;
- volatile float Y3;
- volatile float X4;
- volatile float Y4;
+ float X1;
+ float Y1;
+ float X2;
+ float Y2;
+ float X3;
+ float Y3;
+ float X4;
+ float Y4;
} FTData;
/* we add some shit at the end for other legacy proto, sadly */
-typedef struct __FTHeap {
+typedef struct FTHeap__ {
FTData data;
- volatile int32_t GameID;
- volatile unsigned char table[8];
- volatile int32_t GameID2;
+ int32_t GameID;
+ unsigned char table[8];
+ int32_t GameID2;
} FTHeap;