Re: signal handling in plpython - Mailing list pgsql-hackers

From Tom Lane
Subject Re: signal handling in plpython
Date
Msg-id 7672.1476450357@sss.pgh.pa.us
Whole thread Raw
In response to Re: signal handling in plpython  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: signal handling in plpython  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
I wrote:
> Py_AddPendingCall is safe to call from a signal handler?  That would
> be ... quite remarkable.

I think that a much safer way to proceed would be, rather than asking
"how can I mess with the signal handlers", asking "how can I make my
python code act like it is sprinkled with CHECK_FOR_INTERRUPTS calls".

After some perusing of the Python docs I think it might be possible to
do this by setting up a trace function (cf Py_tracefunc()) that returns
a Python error condition if InterruptPending && (QueryCancelPending ||
ProcDiePending) is true.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: Renaming of pg_xlog and pg_clog
Next
From: Heikki Linnakangas
Date:
Subject: Re: signal handling in plpython