.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
unixthreadname.py
Go to the documentation of this file.
1# SPDX-License-Identifier: AGPL-3.0-or-later
2"""
3if setproctitle is installed.
4set Unix thread name with the Python thread name
5"""
6
7try:
8 import setproctitle
9except ImportError:
10 pass
11else:
12 import threading
13
14 old_thread_init = threading.Thread.__init__
15
16 def new_thread_init(self, *args, **kwargs):
17 # pylint: disable=protected-access, disable=c-extension-no-member
18 old_thread_init(self, *args, **kwargs)
19 setproctitle.setthreadtitle(self._name)
20
21 threading.Thread.__init__ = new_thread_init
new_thread_init(self, *args, **kwargs)