Skip to content

Commit 08c094e

Browse files
committed
Add flushGop for RingBuffer
1 parent 4623101 commit 08c094e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Util/RingBuffer.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,13 @@ class RingBuffer : public std::enable_shared_from_this<RingBuffer<T>> {
433433
}
434434
}
435435

436+
void flushGop(std::function<void(const T &)> cb) {
437+
LOCK_GUARD(_mtx_map);
438+
_storage->getCache().for_each([&](const List<std::pair<bool, T>> &lst) {
439+
lst.for_each([&](const std::pair<bool, T> &pr) { cb(pr.second); });
440+
});
441+
}
442+
436443
void getInfoList(const onGetInfoCB &cb, const typename RingReaderDispatcher::onChangeInfoCB &on_change = nullptr) {
437444
if (!cb) {
438445
return;

0 commit comments

Comments
 (0)