locks

Diez B. Roggisch deetsNOSPAM at web.de
Wed Oct 13 08:11:35 EDT 2004


Ajay wrote:

> what would happen if i try to access a variable locked by another thread?
> i am not trying to obtain a lock on it, just trying to access it.

If you first tell us haw you actually lock a variable, we then might be able
to tell you what happens if you access it....

And in general: python has the PIL - Python Interpreter Lock - that
"brutally" serializes (hopefully) all accesses to python data-structures -
so e.g. running several threads, appending to the same list, won't result
in messing up the internal list structure causing segfaults or the like.
That makes programming pretty easy, at the cost of lots of waiting for the
individual threads.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list