Linux Manual Pages development
 help / color / mirror / Atom feed
From: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
To: Alejandro Colomar <alx@kernel.org>, mtk.manpages@gmail.com
Cc: linux-man@vger.kernel.org
Subject: signal(7): why does it say that pthread_mutex_lock() and thread_cond_wait() can fail with EINTR?
Date: Wed, 1 Jan 2025 23:20:26 +0100	[thread overview]
Message-ID: <Z3W_qgawqyEB-QrA@comp..> (raw)

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>

             reply	other threads:[~2025-01-01 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-01 22:20 Arkadiusz Drabczyk [this message]
2025-01-02  0:19 ` signal(7): why does it say that pthread_mutex_lock() and thread_cond_wait() can fail with EINTR? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z3W_qgawqyEB-QrA@comp.. \
    --to=arkadiusz@drabczyk.org \
    --cc=alx@kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox