This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients nadeem.vawda, neologix, pitrou, sdaoden, vstinner
Date 2011-05-12.23:59:38
SpamBayes Score 1.637579e-14
Marked as misclassified No
Message-id <BANLkTimpJOjWYMbKwEhx+WedghUUT+r5dg@mail.gmail.com>
In-reply-to <1305239640.10158.13.camel@marge>
Content
> Evaluate Python code in a signal handler is really not a good idea!

I know, you're limited to async-safe functions, among other things :-)

> because of the GIL, I don't think that we can do better. But with the
> GIL of Python 3.3, the Python signal handler will be called "immediatly"
> before the next instruction, instead of having to wait something like
> 100 Python instructions (sys.getcheckinterval()). On this point, Python
> 3.3 is better than all previous versions.
>

Nice.

> Well, we can imagine to have an option/function to enable real time
> and/or in-order signals (e.g. using pipes).
>
> Can we call this mode "real time"? Real time means that we warranty a
> maximum response time.
>

Well, I think that we should either make this the default behaviour
(that's why I was asking whether it's possible on Windows), or not
implement it. Having two modes for signal handling is confusing.
But given that this behaviour has never been noticed before and that I
doubt that people needing real-time signals use Python (and
vice-versa), maybe we should just stick with the current
implementation, which is safe and simple (see Antoine's question, "Is
it a theoretical concern or does it affect real software?").
On the other hand, if it turns out to be interesting to some people,
I'd be happy to work on a patch.

>> By the way, to be pedantic, in the current code, wakeup_fd and
>> Handlers should be volatile, and tripped should be sig_atomic_t.
>
> Yes. Can you please write a patch for this?

Patch attached.
Files
File name Uploaded
signal_pedantic.diff neologix, 2011-05-12.23:59:38
History
Date User Action Args
2011-05-12 23:59:39neologixsetrecipients: + neologix, pitrou, vstinner, nadeem.vawda, sdaoden
2011-05-12 23:59:38neologixlinkissue12060 messages
2011-05-12 23:59:38neologixcreate