diff options
| author | armink <[email protected]> | 2016-10-31 15:08:55 +0800 |
|---|---|---|
| committer | armink <[email protected]> | 2016-10-31 15:08:55 +0800 |
| commit | 6fe47a9537e222d6047592c9f113657687e6ce69 (patch) | |
| tree | da92b2a3fd01a40295e2227bed9397c8f7d91eda /components/drivers/src | |
| parent | 0970cf03a4db015d988b4e3fea6bc80f50394ef0 (diff) | |
[DeviceDrivers]Improve dataqueue resume suspended thread code. Thanks for @grissiom suggestion.
Diffstat (limited to 'components/drivers/src')
| -rw-r--r-- | components/drivers/src/dataqueue.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/components/drivers/src/dataqueue.c b/components/drivers/src/dataqueue.c index 1d458eec81..fc4ce1ef1e 100644 --- a/components/drivers/src/dataqueue.c +++ b/components/drivers/src/dataqueue.c @@ -45,7 +45,6 @@ rt_data_queue_init(struct rt_data_queue *queue, queue->size = size; queue->lwm = lwm; - queue->waiting_lwm = RT_FALSE; queue->get_index = 0; queue->put_index = 0; @@ -80,8 +79,6 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue, level = rt_hw_interrupt_disable(); while (queue->put_index - queue->get_index == queue->size) { - queue->waiting_lwm = RT_TRUE; - /* queue is full */ if (timeout == 0) { @@ -218,8 +215,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, queue->get_index += 1; - if ((queue->waiting_lwm == RT_TRUE) && - (queue->put_index - queue->get_index) <= queue->lwm) + if ((queue->put_index - queue->get_index) <= queue->lwm) { /* * there is at least one thread in suspended list @@ -241,7 +237,6 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, } else { - queue->waiting_lwm = RT_FALSE; rt_hw_interrupt_enable(level); } |
