On Thu, Nov 24, 2016 at 10:14 PM, Marko Rauhamaa <ma...@pacujo.net> wrote:
> When you use threads, you call read(2) in the blocking mode. Then the
> read(2) operation will block "for ever." There's no clean way to cancel
> the system call.

Signals will usually interrupt system calls, causing them to return
EINTR. There are exceptions (the aforementioned uninterruptible calls,
but they're not available in nonblocking form, so they're the same for
threads and coroutines), but the bulk of system calls will halt
cleanly on receipt of a signal. And yes, you CAN send signals to
specific threads; there are limitations, but for a language like
Python, there's no difficulty in having a single disposition for (say)
SIGINT, and then using thread signalling to figure out which thread
should have KeyboardInterrupt raised in it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to