Mutex not thread safe? PEP-3108.

R

Roy Smith

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?
 
S

skip

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.

Skip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top