kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added reset() method to RingBuffer class
rodzic
275ef16977
commit
90cf0f6f58
|
@ -175,6 +175,20 @@ public:
|
|||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the buffer to its empty state discarding all the elements stored.
|
||||
*
|
||||
* Note: reset is "lazy", as it just sets read pointer, write pointer and
|
||||
* number of elements to zero. No actual erasure of the stored elements is
|
||||
* done until they are effectively overwritten by new push()es.
|
||||
*/
|
||||
void reset()
|
||||
{
|
||||
readPos = 0;
|
||||
writePos = 0;
|
||||
numElements = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
size_t readPos; ///< Read pointer.
|
||||
|
|
Ładowanie…
Reference in New Issue