According to the description of pthread_mutex_lock() (in the
function's comment block):

"If a signal is delivered to a thread waiting for a mutex, upon return
from the signal handler the thread resumes waiting for the mutex as if
it was not interrupted."

But I don't see it. From my reading of the code (please correct me if
I'm mistaken):

pthread_mutex_lock() is a thin wrapper around
pthread_mutex_timedlock() with NULL abs_timeout.

The comment block above pthread_mutex_timedlock() does not make a
similar statement regarding receipt of a signal.

pthread_mutex_timedlock() calls pthread_mutex_take() with a intr value
of true, which in turn calls pthread_sem_take() with intr value of
true, which calls nxsem_wait().

nxsem_wait() returns -EINTR if awakened by a signal.

In the above mentioned callers, I don't see any logic that detects
this case and resumes waiting for the mutex as if it was not
interrupted.

Am I correct?

Thanks,
Nathan

Reply via email to