Skip to content
Alternative approach to locking in Python, supporting shared-exclusive (reader-writer) locks.
Python Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Alternative approach to locking in Python, supporting shared-exclusive (reader-writer) locks, the simultaneous locking of multiple objects, and timeouts.

In general terms, the motivation for this code was the need in threaded code to prevent concurrent manipulation of arbitrary resources not known in advance, based on their identifiers - the kind of situation where you might be thinking along the lines of a pool of locks, with new locks being created as necessary on demand. A specific example of the problem is described on stackoverflow: the need to "prevent any two threads from running the same function with the same argument at the same time". The code here is based on the answer provided by David Z to that question.

The easiest way to understand the use case may be to look at the[test code].

See LICENSE for copyright and license notice. Released as open source by authority of William Oppermann, MPSTOR, December, 2014.

You can’t perform that action at this time.