Yes and no. I've posted a code from sem_wait that checks if a cancellation is pending but cannot be performed due to the nesting level, so enter_cancellation_point will just increment the nested count and leave_cancellation_point will just decrement it. In this case ECANCELED will be returned by sem_wait and _SEM_WAIT() will be called again endlessly because cancelation nesting counted will just increment and decrement. Best regards, Petro
_SEM_WAIT maps to either nxsem_wait or sem_wait. The cancellation point applies only to sem_wait.
This should not happen in reality because OS cancellation points never call other functions that are cancellation points. That is because the cancellation point is inside the OS and must never use the application-oriented interfaces (like sem_wait) but only internal OS interfaces like nxsem_wait. In that case, cancellation points will never be nested.
I had it on my To-Do list for a long time to remove the nested cancellation point support. It should never occur and the logic that you are referring to should be replaced with an assertion. I thought that there was an Issue covering this, but I don't see it.