Re: Remove pthread_is_threaded_np() checks in postmaster

Поиск
Список
Период
Сортировка
От Tristan Partin
Тема Re: Remove pthread_is_threaded_np() checks in postmaster
Дата
Msg-id CYMH3F7DEFXB.1ZMPD4IZNXS27@neon.tech
обсуждение исходный текст
Ответ на Re: Remove pthread_is_threaded_np() checks in postmaster  (Andres Freund <andres@anarazel.de>)
Ответы Re: Remove pthread_is_threaded_np() checks in postmaster
Список pgsql-hackers
On Tue Jan 23, 2024 at 4:23 PM CST, Andres Freund wrote:
> Hi,
>
> On 2024-01-23 15:50:11 -0600, Tristan Partin wrote:
> > What is keeping us from using pthread_sigmask(3) instead of sigprocmask(2)?
>
> We would need to make sure to compile with threading support everywhere. One
> issue is that on some platforms things get slower once you actually start
> using pthreads.

What are examples of these reduced performance platforms?

From reading the meson.build files, it seems like building with
threading enabled is the future, so should we just rip the band-aid off
for 17?

> > If an extension can guarantee that threads that get launched by it don't
> > interact with anything Postgres-related, would that be enough to protect
> > from any fork(2) related issues?
>
> A fork() while threads are running is undefined behavior IIRC, and undefined
> behavior isn't limited to a single thread. You'd definitely need to use
> pthread_sigprocmask etc to address that aspect alone.

If you can find a resource that explains the UB, I would be very
interested to read that. I found a SO[0] answer that made it seem like
this actually wasn't the case.

[0]: https://stackoverflow.com/a/42679479/7572728

--
Tristan Partin
Neon (https://neon.tech)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Support TZ format code in to_timestamp()
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [PATCH] Add native windows on arm64 support