Re: Remove pthread_is_threaded_np() checks in postmaster

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Remove pthread_is_threaded_np() checks in postmaster
Дата
Msg-id 20240123222347.4ejkxhbokudcime2@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: Remove pthread_is_threaded_np() checks in postmaster  ("Tristan Partin" <tristan@neon.tech>)
Ответы Re: Remove pthread_is_threaded_np() checks in postmaster
Список pgsql-hackers
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.


> 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.

Greetings,

Andres Freund



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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: On login trigger: take three
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Support TZ format code in to_timestamp()