Skip to content

Commit

Permalink
xcirclebuffer atomic read/write variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed May 14, 2024
1 parent 11322f4 commit 0f800a5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/util_buffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <vector>
#include <queue>
#include <iostream>
#include <atomic> // added 1.5.2.5 (ge) for "lock-free" circle buffer

#define DWORD__ t_CKUINT
#define SINT__ t_CKINT
Expand Down Expand Up @@ -382,13 +383,13 @@ class XCircleBuffer
// the buffer
T * m_buffer;
// the buffer length (capacity)
volatile long m_length;
std::atomic_ulong m_length;
// write index
volatile long m_writeIndex;
std::atomic_ulong m_writeIndex;
// read index
volatile long m_readIndex;
std::atomic_ulong m_readIndex;
// num elements
volatile long m_numElements;
std::atomic_ulong m_numElements;
};


Expand Down

0 comments on commit 0f800a5

Please sign in to comment.