Change in vdsm[master]: virt: migration: use contextmanager for monitor
nsoffer at redhat.com
nsoffer at redhat.com
Fri Jun 13 22:26:56 UTC 2014
Nir Soffer has posted comments on this change.
Change subject: virt: migration: use contextmanager for monitor
......................................................................
Patch Set 20:
(1 comment)
http://gerrit.ovirt.org/#/c/25978/20/vdsm/virt/migration.py
File vdsm/virt/migration.py:
Line 340: monitorThread.start()
Line 341: try:
Line 342: yield monitorThread
Line 343: finally:
Line 344: monitorThread.stop()
This can be much more useful as general utility for things that you can start and stop.
@contextmanager
def running(thing):
thing.start()
try:
yield
finally:
thing.stop()
Usage:
self._thread = FooThread()
with running(self._thread):
do staff
and some more
Line 345:
Line 346:
Line 347: class MonitorThread(threading.Thread):
Line 348: _MONITOR_TICK = 1.0 # unit: seconds
--
To view, visit http://gerrit.ovirt.org/25978
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie7fcd0bedf4f30cc0bcab03339322df1fc5434e8
Gerrit-PatchSet: 20
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list