Change in vdsm[master]: lib: pthread: allow to set system thread names
fromani at redhat.com
fromani at redhat.com
Tue May 19 15:53:23 UTC 2015
Francesco Romani has posted comments on this change.
Change subject: lib: pthread: allow to set system thread names
......................................................................
Patch Set 6:
(3 comments)
https://gerrit.ovirt.org/#/c/41052/6/lib/vdsm/pthread.py
File lib/vdsm/pthread.py:
Line 44: def setname(name):
Line 45: """
Line 46: Allows to set a system-wide thread name.
Line 47: This decorator should be used on `func' callables which implement
Line 48: a threading.Thread target.
> This is not very clear, lets clarify and give an example:
Turns out that the decorator is actually harder to implement in a few cases (like the executor's Workers).
Originally, I thought it was nicer, turns out I was wrong.
Will turn into a plain function, which is also easier to test.
Line 49: The length of the name is limited to 15 bytes - see pthread_setname_np(3)
Line 50: The system name must be an ASCII string at most 15 characters long.
Line 51: """
Line 52: if len(name) > 15:
Line 46: Allows to set a system-wide thread name.
Line 47: This decorator should be used on `func' callables which implement
Line 48: a threading.Thread target.
Line 49: The length of the name is limited to 15 bytes - see pthread_setname_np(3)
Line 50: The system name must be an ASCII string at most 15 characters long.
> Last 2 lines say the same thing, lets merge them:
rebase glitch, will fix.
Line 51: """
Line 52: if len(name) > 15:
Line 53: raise ValueError("Expecting up to 15 bytes for the name")
Line 54:
Line 49: The length of the name is limited to 15 bytes - see pthread_setname_np(3)
Line 50: The system name must be an ASCII string at most 15 characters long.
Line 51: """
Line 52: if len(name) > 15:
Line 53: raise ValueError("Expecting up to 15 bytes for the name")
> bytes is not a good term, lets use characters.
will add explicit encode step.
I actually intentionally used "bytes", since one character may be encoded into multiple bytes. Turns out I obtained the opposite effect :)
Line 54:
Line 55: def decorator(func):
Line 56: @functools.wraps(func)
Line 57: def wrapper(*args, **kwargs):
--
To view, visit https://gerrit.ovirt.org/41052
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib96bd0471a07449d2a0a0328137e8437aefad901
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list