patacongo commented on issue #9695: URL: https://github.com/apache/nuttx/issues/9695#issuecomment-1620482697
> The `-ECANCELED` is returned always because of nested cancelation point. The most top `enter_cancellation_point()` is called from `open()`, so all later calls of cancelable APIs from inside the `open()` will be a nested cancelation points: That is probably the problem. That cancellation logic was intended to handle the case where calls so cancellation points are nested. It only supports unwinding back to the first cancellation point where the cancellation can occur. So I misspoke earlier. In general, the cancelation does not "latch", but it does latch in the cancellation point logic but only to assure that the call sequence unwinds properly. That cancellation unwind logic, however, does not work in a loop like the one in nxmutex_lock(). But you have already spotted that. sem_wait() is not compatible with the logic in nxmutex_lock()! nxmutex_lock() should call nxsem_wait(), rather that sem_wait() to avoid the nested cancellation point logic. But that would require a new syscall. sem_wait() is a system call only because the cancellation point logic needs to run in kernel space. We would need another nxsem_wait() system call. I hate to see system calls proliferate. They should be treating like a precious resource since they add size to the kernel and on many platforms the number of system calls is limited by the instruction set. So other solutions would be preferable. -- 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]
