Made changes while import prctl
This commit is contained in:
parent
a836d0a9af
commit
d81fb4b63e
|
@ -5,7 +5,11 @@ import threading
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import prctl
|
import prctl
|
||||||
|
except ImportError:
|
||||||
|
def set_thread_name(name):
|
||||||
|
"""Set the thread name for external use (visible from the OS)."""
|
||||||
|
threading.current_thread().name = name
|
||||||
|
else:
|
||||||
def set_thread_name(name):
|
def set_thread_name(name):
|
||||||
"""Set a name for the thread for python internal use."""
|
"""Set a name for the thread for python internal use."""
|
||||||
prctl.set_name(name)
|
prctl.set_name(name)
|
||||||
|
@ -16,10 +20,6 @@ try:
|
||||||
|
|
||||||
threading.Thread.__bootstrap_original__ = threading.Thread._Thread__bootstrap
|
threading.Thread.__bootstrap_original__ = threading.Thread._Thread__bootstrap
|
||||||
threading.Thread._Thread__bootstrap = _thread_name_hack
|
threading.Thread._Thread__bootstrap = _thread_name_hack
|
||||||
except ImportError:
|
|
||||||
def set_thread_name(name):
|
|
||||||
"""Set the thread name for external use (visible from the OS)."""
|
|
||||||
threading.current_thread().name = name
|
|
||||||
|
|
||||||
|
|
||||||
class StoppableThread(object):
|
class StoppableThread(object):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user