diff options
| author | Lim-LinYuanbo <[email protected]> | 2021-08-15 14:50:31 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-15 14:50:31 +0800 |
| commit | 7c5f552103f82d37d694c6d2c1c60e35a4503f72 (patch) | |
| tree | eef14793c2f0f196ead869341afbe06ab9b7944e /components/drivers/src/ringbuffer.c | |
| parent | 0e28321c2cfe8273234135a78ce78ac0c4d1d505 (diff) | |
| parent | fea12e0903bf0d2e6efed7aa6838c28d1006e1f5 (diff) | |
Merge branch 'RT-Thread:master' into master
Diffstat (limited to 'components/drivers/src/ringbuffer.c')
| -rw-r--r-- | components/drivers/src/ringbuffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c index 29de20b087..f01a594609 100644 --- a/components/drivers/src/ringbuffer.c +++ b/components/drivers/src/ringbuffer.c @@ -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; } |
