Read-write lock for Python

Geoff Bache geoff.bache at gmail.com
Thu Apr 28 13:14:45 EDT 2011


On Thu, Apr 28, 2011 at 4:28 PM, Jean-Michel Pichavant
<jeanmichel at sequans.com> wrote:
> Geoff Bache wrote:
>>>> Hi all,
>>>> I currently find myself needing a Python read-write lock. I note that
>> there is none in the standard library, but googling "python read-write
>> lock" quickly produced 6 different competing examples, including two
>> languishing patch proposals for the standard library.
>>>> I can always pick a random one and hope for the best, but I was hoping
>> someone here might have a tip for one that has been used and debugged
>> and is likely to work.
>>>> Regards,
>> Geoff Bache
>>>> What about
>> http://docs.python.org/library/threading.html#lock-objects

Those aren't read-write locks. They are basic locks, which don't
distinguish between readers and writers. I need to be able to lock
between reader and writer operations, without readers locking each
other out.
/Geoff


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /