diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-06-30 02:42:59 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-06-30 02:42:59 +0000 |
commit | c5931529675a863e7173635c5f8779f78b3940e2 (patch) | |
tree | bb0b75a9d6cda24d607958c706d1e02b380e2dae /src/ringbuf.h | |
parent | 9873e07c5abf787d7805b4266a243e56240354dc (diff) | |
download | mpd-c5931529675a863e7173635c5f8779f78b3940e2.tar.gz mpd-c5931529675a863e7173635c5f8779f78b3940e2.tar.xz mpd-c5931529675a863e7173635c5f8779f78b3940e2.zip |
ringbuf: add thread-safe, thread-specific reset functions
This will allow both the reader and writer threads to
reset the ringbuffer in a thread-safe fashion.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7390 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/ringbuf.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ringbuf.h b/src/ringbuf.h index 1465e8fa2..d4baffdbd 100644 --- a/src/ringbuf.h +++ b/src/ringbuf.h @@ -173,6 +173,24 @@ size_t ringbuf_read_space(const struct ringbuf * rb); void ringbuf_reset(struct ringbuf * rb); /** + * Reset the write pointer to the read pointer, making an empty buffer. + * + * This should only be called by the writer + * + * @param rb a pointer to the ringbuffer structure. + */ +void ringbuf_writer_reset(struct ringbuf * rb); + +/** + * Reset the read pointer to the write pointer, making an empty buffer. + * + * This should only be called by the reader + * + * @param rb a pointer to the ringbuffer structure. + */ +void ringbuf_reader_reset(struct ringbuf * rb); + +/** * Write data into the ringbuffer. * * @param rb a pointer to the ringbuffer structure. |