We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e12f116 commit 839cd7eCopy full SHA for 839cd7e
platform/CircularBuffer.h
@@ -104,7 +104,24 @@ class CircularBuffer {
104
_full = false;
105
core_util_critical_section_exit();
106
}
107
-
+
108
+ /** Returns the number of available transactions the buffer contains */
109
+ CounterType available() {
110
+ core_util_critical_section_enter();
111
+ CounterType elements;
112
+ if (!_full)
113
+ {
114
+ if (_head < _tail)
115
+ elements = BufferSize + _head - _tail;
116
+ else
117
+ elements = _head - _tail;
118
+ }
119
120
+ elements = BufferSize;
121
+ core_util_critical_section_exit();
122
+ return elements;
123
124
125
private:
126
T _pool[BufferSize];
127
volatile CounterType _head;
0 commit comments