ソースを参照

[DeviceDrivers]Reset dataqueue waiting_lwm flag when suspended_push_list is empty

armink 8 年 前
コミット
0970cf03a4
1 ファイル変更2 行追加2 行削除
  1. 2 2
      components/drivers/src/dataqueue.c

+ 2 - 2
components/drivers/src/dataqueue.c

@@ -20,6 +20,7 @@
  * Change Logs:
  * Change Logs:
  * Date           Author       Notes
  * Date           Author       Notes
  * 2012-09-30     Bernard      first version.
  * 2012-09-30     Bernard      first version.
+ * 2016-10-31     armink       fix some resume push and pop thread bugs
  */
  */
 
 
 #include <rtthread.h>
 #include <rtthread.h>
@@ -220,8 +221,6 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
     if ((queue->waiting_lwm == RT_TRUE) && 
     if ((queue->waiting_lwm == RT_TRUE) && 
         (queue->put_index - queue->get_index) <= queue->lwm)
         (queue->put_index - queue->get_index) <= queue->lwm)
     {
     {
-        queue->waiting_lwm = RT_FALSE;
-
         /*
         /*
          * there is at least one thread in suspended list
          * there is at least one thread in suspended list
          * and less than low water mark
          * and less than low water mark
@@ -242,6 +241,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
         }
         }
         else
         else
         {
         {
+            queue->waiting_lwm = RT_FALSE;
             rt_hw_interrupt_enable(level);
             rt_hw_interrupt_enable(level);
         }
         }