You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/05/27 15:15:03 UTC
[GitHub] [incubator-nuttx] patacongo commented on a diff in pull request #6338: sched/semaphore: sem_wait should not report ECANCELED
patacongo commented on code in PR #6338:
URL: https://github.com/apache/incubator-nuttx/pull/6338#discussion_r883710600
##########
sched/semaphore/sem_wait.c:
##########
@@ -251,37 +251,21 @@ int nxsem_wait_uninterruptible(FAR sem_t *sem)
int sem_wait(FAR sem_t *sem)
{
- int errcode;
int ret;
/* sem_wait() is a cancellation point */
- if (enter_cancellation_point())
- {
-#ifdef CONFIG_CANCELLATION_POINTS
- /* If there is a pending cancellation, then do not perform
- * the wait. Exit now with ECANCELED.
- */
-
- errcode = ECANCELED;
- goto errout_with_cancelpt;
-#endif
- }
+ enter_cancellation_point();
Review Comment:
I think that this has an unacceptable side effect. In the deferred cancellation mode, there could be a cancellation pending on entry into sem_wait().
POSIX required that the deferred cancellation pend until a cancellation point function is called. But with this change, sem_wait() will ignore the deferred cancelation and just continue to wait.
The result would be that the cancellation is lost.
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org