This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kristjan.jonsson
Recipients Sebastian.Noack, asvetlov, christian.heimes, jyasskin, kristjan.jonsson, mklauber, neologix, pitrou, sbt
Date 2012-10-02.12:22:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Ah, you are implementing an FIFO lock.  That should have been made clear.
I see it now that you grant the lock in the order that the acquisition is attempted.
Ok, this is fine, but with one important caveat:  Explicit handoff such as that can suffer from "lock convoying".  In contested situation this can result in the protected resource being much less available than it ought to be.

In my dayjob, I write locking primitives for Stackless Python.  We used to employ handoff until we found out that this caused performance problems.  All the locking primitives now used by Eve Online and in Stacklesslib are 'greedy' and don't attempt fairness.  This has resulted in much improvement in resource usage.

For this reason, I explicitly did not build any such mechanism into my RWLock implementation.  Any thread coming in can claim the lock, provided the policy (writer priority policy) doesn't kick in.
In those rare cases where a special locking policy such as FIFO fairness is _required_ it is always possible to construct such a thing in python using e.g. a queue of condition variables.

For information on this, please see the following resource:,guid,e40c2675-43a3-410f-8f85-616ef7b031aa.aspx
Date User Action Args
2012-10-02 12:22:46kristjan.jonssonsetrecipients: + kristjan.jonsson, pitrou, christian.heimes, jyasskin, asvetlov, neologix, sbt, mklauber, Sebastian.Noack
2012-10-02 12:22:46kristjan.jonssonsetmessageid: <>
2012-10-02 12:22:46kristjan.jonssonlinkissue8800 messages
2012-10-02 12:22:45kristjan.jonssoncreate