threads and dictionaries

Aahz Maruch aahz at panix.com
Mon Dec 11 14:57:42 EST 2000


In article <9139fq$ovj$1 at nnrp1.deja.com>,  <bartig at pinpoint.com> wrote:
>
>I'm writing a program that passes dictionaries into a subroutine that's
>threaded.  Are dictionaries thread safe?  If so how would I go about
>making changes to the dictionaries inside of a thread so that other
>threads can take advantage this?

Dictionaries are as thread-safe as any other Python variable.  That is,
if there's any chance that one thread will try to perform multiple
operations on a dict at the same time that any other thread will try to
perform other operations, you'd better stick in a critical section lock.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

What if there were no rhetorical questions?  --Aahz



More information about the Python-list mailing list