mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] The sigtimedwait function can't return EINTR
@ 2024-06-25  6:14 =?gb18030?B?s/DT8bzT?=
  2024-06-26 15:30 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: =?gb18030?B?s/DT8bzT?= @ 2024-06-25  6:14 UTC (permalink / raw)
  To: =?gb18030?B?bXVzbA==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 217 bytes --]

Hi,


Why not check for EINTR errors in sigwait function instead of sigtimedwait function?
In posix, the sigtimedwait function can return an EINTR error.

Can you give me a reason for this situation?


Thanks

[-- Attachment #2: Type: text/html, Size: 364 bytes --]

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

* Re: [musl] The sigtimedwait function can't return EINTR
  2024-06-25  6:14 [musl] The sigtimedwait function can't return EINTR =?gb18030?B?s/DT8bzT?=
@ 2024-06-26 15:30 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2024-06-26 15:30 UTC (permalink / raw)
  To: 仇玉加; +Cc: musl

On Tue, Jun 25, 2024 at 02:14:29PM +0800, 仇玉加 wrote:
> Hi,
> 
> 
> Why not check for EINTR errors in sigwait function instead of sigtimedwait function?
> In posix, the sigtimedwait function can return an EINTR error.

It's a may fail, not a shall fail, so either behavior is allowed.

> Can you give me a reason for this situation?

Commit 0a949ebdf0b9fc054ea868bd049c8f2c7aed973e documents that it was
necessary that sigwait not fail with EINTR, so the logic to retry in
EINTR had to be added either in sigwait or sigtimedwait.

Generally we don't utilize "may fail" unless there's a good reason. In
the case of sigtimedwait, I think my reasoning was that it's already
waiting for one of a set of signals, and you could just include the
signal(s) you want to be interrupted by in that set. Since the EINTR
condition is not mandatory, this is the only portable way to do it.

Rich

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

end of thread, other threads:[~2024-06-26 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25  6:14 [musl] The sigtimedwait function can't return EINTR =?gb18030?B?s/DT8bzT?=
2024-06-26 15:30 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).