[Python-Dev] Extension modules, Threading, and the GIL

"Martin v. Löwis" martin@v.loewis.de
Wed, 08 Jan 2003 18:22:37 +0100


David Abrahams wrote:
> IIUC, that strategy doesn't get Mark what he wants in this case:
> 
>     2.2) Extensions that *may* take a little time, but more to the
>     point, may directly and synchronously trigger callbacks.  That is,
>     it is not expected that much time will be spent outside of Python,
>     but rather that Python will be re-entered.
> 
> Which is to be able to avoid releasing the GIL in the case where the
> extension isn't going to do much other than invoke the callback
> function which re-acquires it.

I think you are incorrectly interpreting Mark's priorities:

    I am not looking for a change in semantics, just a
    simple way to do it (and maybe even a fast way to do it,
    but that is secondary).

So performance is not the his primary goal. The goal is that it is
easy to use, and I think my strategy is fairly easy to follow: If in
doubt, release the lock.

Regards,
Martin