★ wanayoo — archive 1999 https://mail.python.org/pipermail/pythonmac-sig/2002-April/005443.htmlNouvelle recherche | Portail wanayoo

[Pythonmac-SIG] Threading and FrameWork.Application

Just van Rossum just@letterror.com
Wed, 10 Apr 2002 09:39:56 +0200


Jack Jansen wrote:

> I've been thinking about this a bit more, and I now think it's 
> wrong, really.

I've been thinking, too, but I haven't reached any conclusions, though ;-)

> Shouldn't the toolbox call release the global interpreter lock? 
> Are there any toolbox calls for which this would be unsafe (i.e. 
> the calls that have a callback into Python, maybe)?

WaitNextEvent() on the one hand should indeed release the GIL (as it blocks),
but on the other hand it may call into Python at any time, due to a Carbon Event
that wants to be handled. This would mean (I think) that at each Python callback
entry point the GIL should be acquired again. And that in turn seems to mean
that we should release the GIL when entering *any* call that could trigger a
Carbon Event handler. Eg. RunApplicationEventLoop(), TrackMouseLocation(), etc.

Just