Extension libraries, spawned threads, and the global interpreter lock

Damien Elmes resolve at repose.REMOVE.cx
Thu Jan 3 08:57:32 EST 2002


Michael Hudson <mwh at python.net> writes:

> Damien Elmes <resolve at repose.REMOVE.cx> writes:
> 
> > The problem is that the interactive interpreter installs a sigint
> > handler, which is sort of rude for a library to remove when it's
> > instantianted. I think the 'default' behavior for interactive use is
> > installed once per statement anyway, so if I were to try modify the
> > behavior, it wouldn't change this problem.
> 
> If the interactiuve interpreter is involved, you get to fight readline too.
> 
> Good luck.

Thanks :-)

> You could try using a build without readline -- painful to use, but it
> might just help.

That stopped the segfaults from occuring - instead of three KeyboardInterrupt
messages appearing at once, only one does. 

Does it seem likely the problem lies in the behavior of the readline module?
I'm pretty it's just some silly oversight on my behalf, but I can't see why
this is happening, as AFAIK, the signals should only be being directed to the
main thread

I've done 

  PyEval_InitThreads();

in the extension module before any threads are forked, but these threads are
created by the pthread library. I have no desire to access python functions
from them, I just figured they may need an interpreter lock when they get a
signal.

I'll keep on hunting. Thanks for your patience.

-- 
Damien Elmes
resolve at repose.cx



More information about the Python-list mailing list