[Pyrex] Pyrex and the GIL

Grant McDonald gmcdonald at infocomp.com
Fri Sep 9 04:20:15 CEST 2005


> That's not right either, because when calling
> out to such a function you need to ensure that
> the GIL is *not* held.

Assuming we are talking about a wrapper function which toggles the GIL state
around the function/method that is decorated with whatever the keyword ends
up being. What is the proposed behaviour? We have a number of different
scenarios which can occur, enumerating these may help to indicate the
direction that the naming of the keyword should pursue.

1) Function foo requires GIL to be acquired, Calling scope holds the GIL.

2) Function foo requires GIL to be acquired, Calling scope does not hold the
GIL.

3) Function foo requires GIL to be released, Calling scope holds the GIL.

4) Function foo requires GIL to be released, Calling scope does not hold the
GIL.

Do we base the behaviour on a combination of the calling scope and the
function requirements? E.g. when the calling scope holds the GIL and the
function requires the GIL to be acquired we don't release the GIL at the end
of the function. Extending this type of behaviour would make the semantics
of 'ensure_gil' and 'ensure_no_gil' precise and unambiguous.

Just my $0.02

Regards,

Grant M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20050909/ca4101e0/attachment.html


More information about the Pyrex mailing list