File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ class CircularBuffer {
89
89
90
90
/* * Pop the transaction from the buffer
91
91
*
92
- * @param data Data to be pushed to the buffer
92
+ * @param data Data to be popped from the buffer
93
93
* @return True if the buffer is not empty and data contains a transaction, false otherwise
94
94
*/
95
95
bool pop (T& data) {
@@ -154,6 +154,22 @@ class CircularBuffer {
154
154
core_util_critical_section_exit ();
155
155
return elements;
156
156
}
157
+
158
+ /* * Peek into circular buffer without popping
159
+ *
160
+ * @param data Data to be peeked from the buffer
161
+ * @return True if the buffer is not empty and data contains a transaction, false otherwise
162
+ */
163
+ bool peek (T& data) const {
164
+ bool data_updated = false ;
165
+ core_util_critical_section_enter ();
166
+ if (!empty ()) {
167
+ data = _pool[_tail];
168
+ data_updated = true ;
169
+ }
170
+ core_util_critical_section_exit ();
171
+ return data_updated;
172
+ }
157
173
158
174
private:
159
175
T _pool[BufferSize];
You can’t perform that action at this time.
0 commit comments