aboutsummaryrefslogtreecommitdiffstats
path: root/src/ringbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ringbuf.c')
-rw-r--r--src/ringbuf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ringbuf.c b/src/ringbuf.c
index 569a70757..ed46c3beb 100644
--- a/src/ringbuf.c
+++ b/src/ringbuf.c
@@ -62,6 +62,18 @@ void ringbuf_reset(struct ringbuf * rb)
rb->write_ptr = 0;
}
+/* Reset the read and write pointers, thread-safe iff called only by writer */
+void ringbuf_writer_reset(struct ringbuf * rb)
+{
+ rb->write_ptr = rb->read_ptr;
+}
+
+/* Reset the read and write pointers, thread-safe iff called only by reader */
+void ringbuf_reader_reset(struct ringbuf * rb)
+{
+ rb->read_ptr = rb->write_ptr;
+}
+
/*
* Return the number of bytes available for reading. This is the
* number of bytes in front of the read pointer and behind the write