[Python-Dev] Where to put the interrupt module?

Kevin Jacobs jacobs@penguin.theopalgroup.com
Fri, 13 Jun 2003 08:39:15 -0400 (EDT)


On Fri, 13 Jun 2003, Just van Rossum wrote:
> The problem is that the pending calls mechanism is for the main thread
> onle, and involves globals (mainly ceval.c's 'pendingcalls' and
> 'things_to_do'). So the first thing we'd need to look into is moving
> those globals to the PyThreadState struct (or to PyThreadState's dict
> object).

Restricting SIGINT delivery is another reason why interrupts are only posted
to the main thread.  See python-dev March 2001 for a thread on that touches
on this issue.  I've been auditing the various thread implementations and
have patches for thread_solaris and thead_pth to bring them in line with how
thread_pthreads handles signal masking.  This will lift the second
requirement for limiting interrupts to the main thread for these platforms.

> (Btw. whatever we do, it won't interrupt blocking system calls, but I
> think that's fine. sys.interrupt() won't interrupt these either.)

It won't unless we add the ability to send a signal via pthread_kill (or the
equivalent) to request an interrupt.  Even then, killing a thread will still
be a fundamentally cooperative process.

-Kevin

-- 
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com