Nir Soffer has posted comments on this change.
Change subject: rwlock: Add simpler RWLock
......................................................................
Patch Set 3:
(1 comment)
https://gerrit.ovirt.org/#/c/42908/3/lib/vdsm/rwlock.py
File lib/vdsm/rwlock.py:
Line 83: class Waiter(object):
Line 84:
Line 85: def __init__(self, wants_write):
Line 86: self.wants_write = wants_write
Line 87: self._event = threading.Event()
Why not have all threads wait on a single condition variable?
Because you cannot control which thread will wake up. This implementation wakes the
first thread in waiters queue (self._waiters[0]).
This seems to the be the behavior in misc.RWLock. I like the fairness and predictability
so I kept this behavior. If you think that we don't need this behavior, we can
simplify using a single condition.
Line 88:
Line 89: def wait(self):
Line 90: self._event.wait()
Line 91:
--
To view, visit
https://gerrit.ovirt.org/42908
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Ala Hino <ahino(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Dima Kuznetsov <dkuznets(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes