On Mon, Aug 29, 2022 at 03:43:55PM -0400, Tom Lane wrote:
> I'd originally intended to make this code "#ifdef __NetBSD__",
> but on looking into the FreeBSD sources I find much the same locking
> logic in their dynamic loader, and now I'm wondering if such behavior
> isn't pretty standard.
I doubt it's standard. POSIX specifies select() to be async-signal-safe.
This NetBSD bug makes select() not be async-signal-safe.
> The added calls should have negligible cost,
> so it doesn't seem unreasonable to do them everywhere.
Agreed. I would make the comment mention the NetBSD version that prompted
this, so we have a better chance of removing the workaround in a few decades.