Message137360
| Author |
vstinner |
| Recipients |
Zhiping.Deng, vstinner |
| Date |
2011年05月31日.14:42:52 |
| SpamBayes Score |
9.8496974e-05 |
| Marked as misclassified |
No |
| Message-id |
<1306852976.23.0.348028577732.issue12224@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Extract of manpage signal(7):
"The following interfaces are never restarted after being interrupted by a signal handler, regardless of the use of SA_RESTART; they always fail with the error EINTR when interrupted by a signal handler:
* ...
* File descriptor multiplexing interfaces: epoll_wait(2), epoll_pwait(2), poll(2), ppoll(2), select(2), and pselect(2)."
Consider siginterrupt(signal, False) as a "best-effort" trick... which doesn't work with select().
If you don't want select() to be interrupted by SIGINT, use:
pthread_sigmask(SIG_BLOCK, [SIGINT]);
select(...)
pthread_sigmask(SIG_UNBLOCK, [SIGINT])
or
pselect(...., [SIGINT])
pselect() is atomic, whereas pthread_sigmask+select is not.
I added recently pthread_sigmask() to the signal module in Python 3.3.
pselect() is not exposed in Python currently. We may add it if it's needed.
--
If you really don't care of SIGINT, you can also ignore it completly using signal(SIGINT, SIG_IGN). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年05月31日 14:42:56 | vstinner | set | recipients:
+ vstinner, Zhiping.Deng |
| 2011年05月31日 14:42:56 | vstinner | set | messageid: <1306852976.23.0.348028577732.issue12224@psf.upfronthosting.co.za> |
| 2011年05月31日 14:42:53 | vstinner | link | issue12224 messages |
| 2011年05月31日 14:42:52 | vstinner | create |
|