Message139091
It's a little bit more complicated than that:
- signals and threads don't mix well together
- this will make syscalls fail with EINTR
- the old SIGALRM handler is lost
- etc
In short, don't use signals.
I'm not sure there's a reliable way to write such a general-purpose wrapper (usually one can use select() with a timeout or spawn a subprocess and use communicate's timeout to achieve this kind of things).
In your use case (issue #12157), I think that letting the test block is fine, since:
- there's no easy way to add a timeout (but you could spawn a new interpreter and use communicate with a timeout if you really wanted to)
- it will be caught by the faulthandler module
- a test killed by faulthandler's timeout is more interesting to fix that a "common" failed test ;-) |
|
Date |
User |
Action |
Args |
2011-06-25 15:59:03 | neologix | set | recipients:
+ neologix, vstinner, mouad |
2011-06-25 15:59:03 | neologix | set | messageid: <1309017543.71.0.579565358621.issue12410@psf.upfronthosting.co.za> |
2011-06-25 15:59:03 | neologix | link | issue12410 messages |
2011-06-25 15:59:03 | neologix | create | |
|