Try not to use atomics in performance code

This commit is contained in:
vsonnier
2017-09-22 22:23:34 +02:00
parent aec0100f78
commit 927d727a16
6 changed files with 135 additions and 82 deletions
+2 -2
View File
@@ -21,8 +21,8 @@ std::map<int, std::thread *> AudioThread::deviceThread;
AudioThread::AudioThread() : IOThread(),
currentInput(nullptr), inputQueue(nullptr), nBufferFrames(1024), sampleRate(0) {
audioQueuePtr.store(0);
underflowCount.store(0);
audioQueuePtr = 0;
underflowCount = 0;
active.store(false);
outputDevice.store(-1);
gain = 1.0;
+3 -3
View File
@@ -92,13 +92,13 @@ public:
static void setDeviceSampleRate(int deviceId, int sampleRate);
//fields below, only to be used by other AudioThreads !
std::atomic_uint underflowCount;
size_t underflowCount;
//protected by m_mutex
std::vector<AudioThread *> boundThreads;
AudioThreadInputQueuePtr inputQueue;
AudioThreadInputPtr currentInput;
std::atomic_uint audioQueuePtr;
std::atomic<float> gain;
size_t audioQueuePtr;
float gain;
private: