On Fri, Mar 6, 2009 at 3:23 AM, Greg Ewing <[email protected]> wrote:
>
> I started to add this to Pyrex, but half way through
> I realised it was going to be much more complicated to
> implement than I had thought, and backed out of the idea
> in favour of having a 'with gil' clause on the whole
> function instead, e.g.
Yes, I understand :-) ...
>> Of course, this one-line patch would enable it.
>>
>> - if s.sy == 'IDENT' and s.systring == 'nogil':
>> + if s.sy == 'IDENT' and s.systring in ('gil', 'nogil'):
>>
>
> You'd have to do quite a lot more than that. I don't
> remember all the details, but essentially if you want to
> use Python stuff anywhere in the function, there's setup
> code that needs to run with the GIL held before you even
> get into the user's code. It's not easy to just turn it
> on half way through.
>
Yes, of course... but I was thinking on taking advantage of this for
getting some king of locking in pure C functions....
Supose you have a a pure C functions (I mean, no Py stuff), perhaps
even declared 'with gil' in its signature... Now suppose that
function access some global variables, then we would be able to get
some sort of (global) locking using a 'with gil' block. Am I being
clear? Do this make sense? Would this be useful?
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev