Are Lists thread safe?

Greg Copeland gtcopeland at gmail.com
Fri Mar 9 20:38:58 CET 2007


On Mar 9, 1:03 pm, "abcd" <codecr... at gmail.com> wrote:
> Are lists thread safe?  Or do I have to use a Lock when modifying the
> list (adding, removing, etc)?  Can you point me to some documentation
> on this?
>
> thanks


Yes there are still some holes which can bite you.  Adding and
removing is thread safe but don't treat the list as locked between
operations unless you specifically do your own locking.  You still
need to be on the lookout for race conditions.

Greg




More information about the Python-list mailing list