Re: libpq and multi-threading

Поиск
Список
Период
Сортировка
От Peter J. Holzer
Тема Re: libpq and multi-threading
Дата
Msg-id 20230503155450.zojytzy5ob5qo5tl@hjp.at
обсуждение исходный текст
Ответ на Re: libpq and multi-threading  (Michael Loftis <mloftis@wgops.com>)
Список pgsql-general
On 2023-05-03 06:35:26 -0600, Michael Loftis wrote:
> That is not a thread. Linux man clone right at the start …
>
> “clone, __clone2, clone3 - create a child process”
>
> What you want is pthread_create (or similar)

clone is the system call which is used to create both processes and
threads (in the early days of Linux that generalization was thought to
be beneficial, but POSIX has all kinds of special rules for processes
and threads so it may actually have made stuff more complicated.)

I do agree that pthread_create (or the C11 thrd_create) is the way to
go. It will just call clone behind the scenes, but it will do so with
the right flags and possibly set up some other stuff expected by the
rest of the C library, too.

There may be good reasons to use the low level function in some cases.
But I'd say that in that case you should better know what that means
exactly.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Вложения

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

Предыдущее
От: "Michael J. Baars"
Дата:
Сообщение: Re: libpq and multi-threading
Следующее
От: Geoff Winkless
Дата:
Сообщение: Re: libpq and multi-threading