[Patches] [ python-Patches-1744382 ] Read Write lock

SourceForge.net noreply at sourceforge.net
Wed Jun 27 20:08:03 CEST 2007


Patches item #1744382, was opened at 2007-06-27 20:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1744382&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Yaakov Nemoy (loupgaroublond)
Assigned to: Nobody/Anonymous (nobody)
Summary: Read Write lock

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1744382&group_id=5470


More information about the Patches mailing list