Jython, GILs and object locking.

Harri Pesonen fuerte at sci.fi
Sat Oct 18 16:08:29 EDT 2003


Dave Kuhlman wrote:
> Harri Pesonen wrote:
>>Aahz wrote:
>>
>>>In article <NmBjb.253$en5.245 at reader1.news.jippii.net>,
>>>Harri Pesonen  <fuerte at sci.fi> wrote:
>>>
>>>>Why? Each thread has its own variables, they are not shared,
>>>>there is no need for synchronizing.
> 
> Just to make this a little more real -- Yes, scripts executed in
> each thread (each sub-interpreter) do have their own variables
> (e.g. their own set of globals) and the scripts executed in that
> thread can execute as through they are separate from and isolated
> from scripts run by other sub-interpreters in other threads.

Correct.

> However, it is possible, for example, to implement in C an
> extension function that, when called, would give scripts executing
> under different sub-interpreters access to a common (set of)
> Python object.  Scripts running under different interpreters that
> manipulate that shared object have to be protected from one
> another.  And, I'm guessing that this is one of the situations
> where we need the GIL.

Yeah, if you want GIL, stick with the current Python.

Harri





More information about the Python-list mailing list