[Python-Dev] Thread safety of deques
Moore, Paul
Paul.Moore at atosorigin.com
Mon Jul 19 17:54:01 CEST 2004
The documentation for the collections.deque type states that "Deques
support thread-safe, memory efficient appends and pops from either
side of the deque". I'm not clear what the implication of saying that
these operations are "thread-safe" is.
To contrast, list.append() does not claim thread safety. Should I
therefore conclude that to append an item in a thread-safe manner to a
list requires a mutex, but not for a deque?
Overall, the documentation does not tend to state what operations
are "atomic" in thread-safety terms. Continuing that trend, it may
be better *not* to make any statement about deques. If we do, then
not saying anything about other types seems to imply that they are
not thread-safe. Which may well be true, but if so should probably
be explicit, once we start making thread safety claims of other data
structures.
This way to the slippery slope... :-)
Paul.
__________________________________________________________________________
This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive this
e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos Origin group
liability cannot be triggered for the message content. Although the
sender endeavours to maintain a computer virus-free network, the sender
does not warrant that this transmission is virus-free and will not be
liable for any damages resulting from any virus transmitted.
__________________________________________________________________________
More information about the Python-Dev
mailing list