Kristján Valur Jónsson added the comment:

I can't say that I'm that familiar with multiprocessing to comment on that in 
particular.
But I do find your approach strange, to create two "lock-like" objects, in 
stead of the more familiar construct of having a "RWLock" (this is known from 
other languages) with two ways of claiming it.

Attached is a new patch.  I've adopted the name "SharableLock" perhaps it is 
bad.  It uses your idea of returning "lock-like" objects that do either shared 
or exclusive locking.

There are two implementations: SharableLock is much like the original patch, 
with two conditions and writer priority.
SimpleSharableLock drops all that, and uses a single condition and ad-hoc 
priority. I've added unittests that show that writer-starvation does not appear 
to be a problem.

Createing a Multiprocessing lock using the SharableLockBase should pose no 
difficulties.

The use of the SharableLock with Condition objects is forced to be Exclusive, 
since Condition objects typcially rely on their associated lock to synchronize 
internal state.

----------
Added file: http://bugs.python.org/file27359/sharablelock.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to