Message143653
> > read() is interrupted after 1 second, it works.
> Does it still work if you don't a create thread beforehand?
Yes, the read() is also interrupted as expected if no thread is created.
> one difference is that Python uses sigaction to setup the signal handler
If the handler is installed using the following code, read() is interrupted:
----------
sigemptyset(&sa.sa_mask);
sa.sa_handler = handler;
sa.sa_flags = 0;
sigaction(SIGALRM, &sa, NULL);
----------
Using sa.sa_flags=SA_RESTART, read() hangs (it is not interrupted). Python uses sigaction with flags=0.
> You could try with sigaction/SA_RESTART.
Using SA_RESTART, read() is not interrupted. But if the program is linked to pthread, read() is always interrupted: with sa_flags=0 or sa_flags=SA_RESTART.
> But OpenBSD's pthread implementation has severe limitations/bugs.
rthread doc contains:
"Future work:
Quite simply, signal handling is one the most complicated aspects of threads to get right. (...)"
http://www.openbsd.org/papers/eurobsd2005/tedu-rthreads.pdf |
|
Date |
User |
Action |
Args |
2011-09-06 21:46:16 | vstinner | set | recipients:
+ vstinner, neologix, rpointel |
2011-09-06 21:46:16 | vstinner | set | messageid: <1315345576.61.0.523842116768.issue12905@psf.upfronthosting.co.za> |
2011-09-06 21:46:16 | vstinner | link | issue12905 messages |
2011-09-06 21:46:15 | vstinner | create | |
|