Are list mutations thread-safe?
Aahz Maruch
aahz at netcom.com
Fri Jun 16 21:38:03 EDT 2000
In article <etd8zw5qfdv.fsf at w20-575-109.mit.edu>,
Alex <cut_me_out at hotmail.com> wrote:
>
>Hi. Can two threads get in each others' way if they simultaneously try
>to mutate a list? How could I make a reliable test to answer a question
>like this?
It depends how they mutate it. I believe that single builtin functions
(e.g. [].append()) are thread-safe. OTOH, [].sort() may not be
thread-safe, particularly if you've got user-defined classes on the list
with __cmp__() defined.
--
--- Aahz (Copyright 2000 by aahz at netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"The only problem with Microsoft is they just have no taste." --Steve Jobs
(From _Triumph of the Nerds_ PBS special)
More information about the Python-list
mailing list