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 loupgaroublond
Recipients
Date 2007-06-27.18:08:03
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This is a Lock for handling both multiple readers and a single or multiple writers.  It allows any number of readers to acquire a 'lock' via a modified semaphore.  It also allows any number of writers to try to acquire a lock, which signals the lock to block new readers from acquiring, until the writers have had a chance to do their business.  Through a simple lock, multiple writers can wait in line, although only one writer can actually write at a time.

It also lets the developer use the 'with' statement, via  methods that return contextmanagers.

I actually had a couple of unimplemented ideas.

A) Writers can specify a deadline (or even use a default) such that after the deadline passes, the lock can use a callback to rollback/kill/pause readers, so that the writer doesn't wait an eternity.

B) Allowing the semaphore to have an upper limit of allowed readers (or anythings), Since I don't need it, i never programmed it, but it should be fairly trivial to implement if there is any demand.
History
Date User Action Args
2007-08-23 15:58:53adminlinkissue1744382 messages
2007-08-23 15:58:53admincreate