yushuailong commented on code in PR #20540:
URL: https://github.com/apache/nuttx/pull/20540#discussion_r4228898511


##########
sched/wqueue/kwork_queue.c:
##########
@@ -144,15 +144,14 @@ static int work_qqueue(FAR struct kwork_wqueue_s *wqueue,
       work_timer_reset(wqueue);
     }
 
-  spin_unlock_irqrestore(&wqueue->lock, flags);
-
   if (delay == 0)
     {
-      /* Immediately wake up the worker thread. */
+      /* Post while the queue lock keeps the semaphore alive. */
 
       nxsem_post(&wqueue->sem);
     }
 
+  spin_unlock_irqrestore(&wqueue->lock, flags);

Review Comment:
   Done, I switched to the _nopreempt lock variants to prevent the worker from 
preempting before the lock is released.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to