Mutex not thread safe? PEP-3108.
Hrvoje Niksic
hniksic at xemacs.org
Tue Sep 23 09:37:56 EDT 2008
Roy Smith <roy at panix.com> writes:
> I'm perusing PEP-3108 and came upon this interesting statement (under the
> "Hardly used" section):
>
> mutex [...] Not thread-safe.
>
> How can a mutex, whose sole reason for existence is to mediate thread
> safety, not be thread safe?
"mutex" is a module designed for use with "sched", not for
multithreading:
"""Mutual exclusion -- for use with module sched
[...]
Of course, no multi-threading is implied -- hence the funny interface
for lock, where a function is called once the lock is aquired.
"""
What is called a mutex in multithreading is known in Python as
threading.Lock, and does work with threads.
More information about the Python-list
mailing list