[ python-Patches-1744382 ] Read Write lock

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.python.patches
Message-ID <[email protected]>
Patches item #1744382, was opened at 2007-06-27 20:08
Message generated for change (Comment added) made by loewis
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.

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

>Comment By: Martin v. Löwis (loewis)
Date: 2007-06-30 19:38

Message:
Logged In: YES 
user_id=21627
Originator: NO

The patch is unacceptable in its current form:
- it should be provided as a patch to threading.py, not as a separate
module
- it should have a name that follows "the convention", which seems to be
that 
  it should have "reader" and "writer" in its name (or "rw"). See how C#
and
  Java do it (and other libraries you can find that provide such a
mechanism)
- it needs documentation
- it needs tests.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1744382&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.