We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d57caa7 + 26acd64 commit 7de647cCopy full SHA for 7de647c
components/drivers/src/ringbuffer.c
@@ -8,6 +8,7 @@
8
* 2012-09-30 Bernard first version.
9
* 2013-05-08 Grissiom reimplement
10
* 2016-08-18 heyuanjie add interface
11
+ * 2021-07-20 arminker fix write_index bug in function rt_ringbuffer_put_force
12
*/
13
14
#include <rtthread.h>
@@ -138,7 +139,8 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
138
139
140
if (length > space_length)
141
{
- rb->read_mirror = ~rb->read_mirror;
142
+ if (rb->write_index <= rb->read_index)
143
+ rb->read_mirror = ~rb->read_mirror;
144
rb->read_index = rb->write_index;
145
}
146
0 commit comments