Message10128
This one is a little bit tricky. CPython ensures signal delivery to the main thread, which especially works well for single-threaded programs like the one from Stack Overflow. But Java delivers signals to a separate signal handling thread.
Perhaps this is why the author in the SO question you referenced (http://stackoverflow.com/a/494273/423006) states:
> This module doesn't play well with threads (but then, who does?)
The reality is that signal handling can be made to work well on CPython and Jython in a portable fashion. So in practice you should follow the advice in http://snakesthatbite.blogspot.com/2010/09/cpython-threading-interrupting.html, although IMHO it's a bit overkill - Python memory model semantics ensure that even a simple boolean flag would work just fine, not just `threading.Event`. |
|
Date |
User |
Action |
Args |
2015-06-22 21:05:58 | zyasoft | set | messageid: <1435007158.52.0.197779576184.issue2371@psf.upfronthosting.co.za> |
2015-06-22 21:05:58 | zyasoft | set | recipients:
+ zyasoft, the |
2015-06-22 21:05:58 | zyasoft | link | issue2371 messages |
2015-06-22 21:05:57 | zyasoft | create | |
|