fork, threads and proper closing

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Jun 30 05:58:22 CEST 2009


In message <cf35773f-600b-44a0-9a5b-
de39d2086c8a at h11g2000yqb.googlegroups.com>, Francesco Bochicchio wrote:

> ... if the thread is waiting for a blocking I/O operation to complete,
> like reading from a socket with no data or waiting for a locked resource
> (i.e. semaphore) to be unlocked, it will not service the queue and will
> not read the 'quit command' (the poison pill), and therefore will not
> quit until the blocking I/O terminates (and it could be never).

Under Linux systems, threads are little different from processes. In 
particular, sending a thread/process a signal will cause any blocking I/O 
operation in progress to abort, either with only some bytes read/written, or 
if nothing was read/written, with an EINTR error.




More information about the Python-list mailing list