Thread-safety of dict

"Martin v. Löwis" martin at v.loewis.de
Fri Jun 1 03:56:18 EDT 2007


> So there you have it: if you're using a dict with custom classes (or
> anything other than str) across multiple threads, and without locking
> it, it's possible (though presumably extremely rare) for a lookup to
> fail even through the key was there the entire time.

That could be fixed by adding a generation counter to the dictionary,
right? Then an adversary would have to arrange for the generation
counter to roll over for lookdict to not notice that the
dictionary was modified.

Regards,
Martin



More information about the Python-list mailing list