Re: Does plpython support threading?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Does plpython support threading?
Дата
Msg-id 27172.1454863526@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Does plpython support threading?  (Jinhua Luo <luajit.io@gmail.com>)
Ответы Re: Does plpython support threading?  (Jinhua Luo <luajit.io@gmail.com>)
Список pgsql-hackers
Jinhua Luo <luajit.io@gmail.com> writes:
> In my plpython function, I create new thread to do some routine works.
> But I found the thread doesn't work, it would run a while, but
> suddenly pause and stop working. For example, I write a test dead loop
> to print something to file, but it would stop printing after some
> time.

> I am wondering whether plpython supports threading or not.

Creating multiple threads inside a Postgres backend is playing with fire.
You can make it work if you're very very careful, but what's more likely
to happen is you get burned.  None of the backend code is multithread
safe, so you must absolutely ensure that control never gets out of
libpython except in the main thread.
        regards, tom lane



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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: pgcommitfest reply having corrupted subject line
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Way to check whether a particular block is on the shared_buffer?