Mutex not thread safe? PEP-3108.

skip at skip at
Tue Sep 23 15:36:14 CEST 2008

>>>>> "Roy" == Roy Smith <roy at> writes:

    Roy> I'm perusing PEP-3108 and came upon this interesting statement
    Roy> (under the "Hardly used" section):

    Roy> mutex [...] Not thread-safe.

    Roy> How can a mutex, whose sole reason for existence is to mediate thread 
    Roy> safety, not be thread safe?

Because it is a mutex in name only.  Take a look at the code.  There is
nothing in there which actually locks the internal data structure against
simultaneous manipulation (a collections.deque instance in this case) from
multiple threads.


More information about the Python-list mailing list