anchao commented on code in PR #21065:
URL: https://github.com/apache/nuttx/pull/21065#discussion_r4400125607
##########
sched/signal/sig_clockwait.c:
##########
@@ -197,6 +197,8 @@ int nxsig_clockwait(int clockid, int flags,
clock_t stop = 0u;
#ifndef CONFIG_DISABLE_ALL_SIGNALS
siginfo_t unbinfo;
+ sigset_t intersection;
+ FAR sigq_t *sigpend;
Review Comment:
Thanks for the review. Both comments have been addressed in 40c391e599:
- changed `sigpend` to `FAR sigpendq_t *`
- limited the pending-signal recheck to the `nxsig_timedwait()` path only
- cleared `rtcb->sigwaitmask` before returning errors from
`nxsig_clockwait()`
##########
sched/signal/sig_clockwait.c:
##########
@@ -253,6 +255,34 @@ int nxsig_clockwait(int clockid, int flags,
rtcb->sigunbinfo = &unbinfo;
own_unbinfo = true;
}
+
+ /* nxsig_timedwait() publishes sigwaitmask before calling this function.
+ * A matching signal can be queued after that publication but before this
+ * task transitions to TSTATE_WAIT_SIG. Re-check the pending set here while
+ * interrupts are disabled so we do not sleep with a waited-for signal
+ * already pending.
+ */
+
+ intersection = nxsig_pendingset(rtcb);
Review Comment:
Done
--
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]