Message52800
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. |
|
Date |
User |
Action |
Args |
2007-08-23 15:58:53 | admin | link | issue1744382 messages |
2007-08-23 15:58:53 | admin | create | |
|