All of lore.kernel.org
 help / color / mirror / Atom feed
* signal(7): why does it say that pthread_mutex_lock() and thread_cond_wait() can fail with EINTR?
@ 2025-01-01 22:20 Arkadiusz Drabczyk
  2025-01-02  0:19 ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: Arkadiusz Drabczyk @ 2025-01-01 22:20 UTC (permalink / raw)
  To: Alejandro Colomar, mtk.manpages; +Cc: linux-man

In man/man7/signal.7 it says:

> If a blocked call to one of the following interfaces is interrupted
> by a signal handler, then the call is automatically restarted after
> the signal handler returns if the SA_RESTART flag was used;
> otherwise the call fails with the error EINTR:
> (...)
> • pthread_mutex_lock(3), pthread_cond_wait(3), and related APIs.

I don't understand this, in my experiments neither
pthread_mutex_lock() nor pthread_cond_wait() return EINTR even if
signal handler was installed without using SA_RESTART flag. The
underlying futex() call indeed fails with EINTR but it's called again
by both glibc and musl. Additionally both
man/man3/pthread_mutex_lock.3 and man/man3/pthread_cond_wait.3 say
that these functions do not return EINTR.

Is my understanding of the signal.7 wrong or does it need some work?

-- 
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-03  1:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-01 22:20 signal(7): why does it say that pthread_mutex_lock() and thread_cond_wait() can fail with EINTR? Arkadiusz Drabczyk
2025-01-02  0:19 ` Alejandro Colomar
2025-01-02  9:53   ` Florian Weimer
2025-01-02 12:13     ` Alejandro Colomar
2025-01-02 19:50       ` Arkadiusz Drabczyk
2025-01-03  1:08         ` Alejandro Colomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.