Jinhua Luo <luajit...@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 -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers