From d580e3043f5c0fe4d1d0d1e64962ed8b33dde2fd Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 6 Jan 2021 22:06:25 +1000 Subject: [PATCH] Remove some unnecessary atomics. --- research/miniaudio_engine.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/research/miniaudio_engine.h b/research/miniaudio_engine.h index 0ddc2d0f..ee1e9bf1 100644 --- a/research/miniaudio_engine.h +++ b/research/miniaudio_engine.h @@ -778,9 +778,9 @@ struct ma_node_base ma_uint16 cachedFrameCountOut; ma_uint16 cachedFrameCountIn; ma_uint16 consumedFrameCountIn; + ma_uint32 readCounter; /* For loop prevention. Compared with the current read count of the node graph. If larger, means a loop was encountered and reading is aborted and no samples read. */ /* These variables are read and written between different threads. */ - volatile ma_uint32 readCounter; /* For loop prevention. Compared with the current read count of the node graph. If larger, means a loop was encountered and reading is aborted and no samples read. */ volatile ma_node_state state; ma_node_input_bus inputBuses[MA_MAX_NODE_BUS_COUNT]; ma_node_output_bus outputBuses[MA_MAX_NODE_BUS_COUNT]; @@ -3555,8 +3555,8 @@ static ma_uint32 ma_node_set_read_counter(ma_node* pNode, ma_uint32 newReadCount This function will be only ever be called in a controlled environment (only on the audio thread, and never concurrently). */ - oldReadCounter = c89atomic_load_32(&pNodeBase->readCounter); - c89atomic_exchange_32(&pNodeBase->readCounter, newReadCounter); + oldReadCounter = pNodeBase->readCounter; + pNodeBase->readCounter = newReadCounter; return oldReadCounter; }