Kristján Valur Jónsson <krist...@ccpgames.com> added the comment:

Martin: I wouldn't worry too much about replacing a "Mutex" with a "Semaphore". 
 There is no reason to believe that they behave in any way different scheduling 
wise, and if they did, then any python code that this would affect would be 
extremely poorly written.

sbt:
Look, I really hate to be a pain but please consider:  In line 50 of your patch 
the thread may pause at any point, perhaps even a number of times.  Meanwhile, 
a number of locks/unlocks may go by.  The values of "owned" and "timeouts" that 
the reader sees may be from any number of different lock states that the lock 
goes through during this, including any number of different reset cycles of 
these counters.  In short, there is no guarantee that the values read represent 
any kind of mutually consistent state.  They might as well be from two 
different locks.

Please allow me to repeat:  Lockless programming is notoriously hard and there 
is almost always one subtlety or other that is overlooked.  I can't begin to 
count the number of times I've reluctantly had to admit defeat to its devious 
manipulations.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11618>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to