Merge pull request #4904 from rtthread-bot/rtt_bot

[update] RT-Thread Robot automatic submission
This commit is contained in:
Bernard Xiong 2021-07-31 08:21:50 +08:00 committed by GitHub
commit 7de647c726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@
* 2012-09-30 Bernard first version.
* 2013-05-08 Grissiom reimplement
* 2016-08-18 heyuanjie add interface
* 2021-07-20 arminker fix write_index bug in function rt_ringbuffer_put_force
*/
#include <rtthread.h>
@ -138,7 +139,8 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
if (length > space_length)
{
rb->read_mirror = ~rb->read_mirror;
if (rb->write_index <= rb->read_index)
rb->read_mirror = ~rb->read_mirror;
rb->read_index = rb->write_index;
}