threads, mutual exclusion, and lists
danmcleran at yahoo.com
danmcleran at yahoo.com
Wed Aug 15 15:38:32 EDT 2007
On Aug 15, 1:36 pm, Scott <smba... at gmail.com> wrote:
> I have two threads that share a python list. One thread adds to the
> list with append(), the other thread removes items with pop().
>
> My question is -- are python list operations atomic? If they are not,
> then I assume I need to put some mutual exclusion around the append()
> and pop() calls ?
>
> Thanks,
> Scott
You might want to consider using a Queue instead. It is designed to be
thread-safe.
More information about the Python-list
mailing list