@@ -73,7 +73,8 @@ impl WaitQueue {
7373 declare_current_waiter ! ( waiter) ;
7474 let mut rq = current_run_queue :: < NoPreemptIrqSave > ( ) ;
7575 rq. blocked_resched ( self . queue . lock ( ) , waiter. clone ( ) ) ;
76- self . queue . lock ( ) . remove ( & waiter) ;
76+ // It can only be notified, it should not be in the list
77+ assert ! ( self . queue. lock( ) . remove( & waiter) . is_none( ) ) ;
7778 }
7879
7980 /// Blocks the current task and put it into the wait queue, until the given
@@ -92,9 +93,13 @@ impl WaitQueue {
9293 if condition ( ) {
9394 break ;
9495 }
96+ // It can only be notified, it should not be in the list
97+ assert ! ( wq. remove( & waiter) . is_none( ) ) ;
9598 rq. blocked_resched ( wq, waiter. clone ( ) ) ;
9699 }
97- self . queue . lock ( ) . remove ( & waiter) ;
100+
101+ // It can only be notified, it should not be in the list
102+ assert ! ( self . queue. lock( ) . remove( & waiter) . is_none( ) ) ;
98103 }
99104
100105 /// Blocks the current task and put it into the wait queue, until other tasks
@@ -117,7 +122,7 @@ impl WaitQueue {
117122 let timeout = axhal:: time:: wall_time ( ) >= deadline;
118123
119124 // Always try to remove the task from wait list.
120- self . queue . lock ( ) . remove ( & waiter) ;
125+ self . queue . lock ( ) . remove ( & waiter) . is_some ( ) ;
121126 // Always try to remove the task from the timer list.
122127 self . cancel_timer ( curr) ;
123128 timeout
@@ -154,7 +159,8 @@ impl WaitQueue {
154159 timeout = false ;
155160 break ;
156161 }
157-
162+ // It can only be notified, it should not be in the list
163+ assert ! ( wq. remove( & waiter) . is_none( ) ) ;
158164 rq. blocked_resched ( wq, waiter. clone ( ) ) ;
159165 }
160166 // Always try to remove the task from wait list.
0 commit comments