patacongo commented on issue #9695:
URL: https://github.com/apache/nuttx/issues/9695#issuecomment-1620296031
Hi, Petro! Clearly the problem is either with (1) in this loop termination
condition:
ret = _SEM_ERRVAL(ret);
if (ret != -EINTR && ret != -ECANCELED)
{
break;
}
Or (2) with the return value from __SEM_WAIT().
The first would happen if the thread has call pthread_mutex_lock() and is
canceled while waiting. That is a normal event. pthread_mutex_lock() is not a
cancellation point, oddly.
https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html .
So the looping behavior is probably normal.
The only odd thing I see is that -ECANCELED should be reported only once.
It does not latch (at least, in the past, it did not latch. I would need to
double check the current behavior). So -ECANCELED should be received once and
should not cause an infinite loop. Similarly with -EINTR; it does not latch
either.
If __SEM_WAIT were reporting -ECANCELED multiple times, that would be an
error and think a lot things would be broken.
So, it seems that __SEM_WAIT() is returning an error??? __SEM_WAIT() does
not often fail so it would be interesting to know if it is returning an error
and what the error is.
--
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]