vrahane commented on code in PR #3117:
URL: https://github.com/apache/mynewt-core/pull/3117#discussion_r1419508360


##########
kernel/os/src/os_eventq.c:
##########
@@ -69,7 +69,8 @@ os_eventq_put(struct os_eventq *evq, struct os_event *ev)
          * Check if task is sleeping, because another event
          * queue may have woken this task up beforehand.
          */
-        if (evq->evq_task->t_state == OS_TASK_SLEEP) {
+        if (evq->evq_task->t_state == OS_TASK_SLEEP &&
+            evq->evq_task->t_flags & OS_TASK_FLAG_EVQ_WAIT) {

Review Comment:
   I think I did not do a good job at explaining this. So, what is happening is 
that we have the default task waiting on a semaphore. The task actually wakes 
up when `os_eventq_put()` is called which should not happen, it should only 
wakeup when `os_sem_release()` is called on the pending semaphore. So, what 
this change does is it forces the scheduler to be blocked on the semaphore even 
though an event is scheduled if thats what the task has been waiting for.
   The above code did the right thing back in 2015-2016 before we added 
`os_eventq_poll()`. You will have to go back into `incubator-mynewt-core` to 
look at the exact code.



-- 
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