From 74ddda8775156d6b4271284b6902058513c5d3d5 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Wed, 18 Apr 2018 14:22:00 +0300 Subject: [PATCH] helper_generic: imports in alphabetical order, import multiprocessing --- src/helper_generic.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/helper_generic.py b/src/helper_generic.py index 46d33e13..ce56a292 100644 --- a/src/helper_generic.py +++ b/src/helper_generic.py @@ -4,18 +4,19 @@ Helper Generic perform generic operations for threading. Also perform some conversion operations. """ + import socket import sys -from binascii import hexlify, unhexlify -from multiprocessing import current_process import threading import traceback +import multiprocessing +from binascii import hexlify, unhexlify import shared import state -from debug import logger import queues import shutdown +from debug import logger def powQueueSize(): @@ -58,15 +59,16 @@ def allThreadTraceback(frame): def signal_handler(signal, frame): + process = multiprocessing.current_process() logger.error( 'Got signal %i in %s/%s', - signal, current_process().name, threading.current_thread().name + signal, process.name, threading.current_thread().name ) - if current_process().name == "RegExParser": + if process.name == "RegExParser": # on Windows this isn't triggered, but it's fine, # it has its own process termination thing raise SystemExit - if "PoolWorker" in current_process().name: + if "PoolWorker" in process.name: raise SystemExit if threading.current_thread().name not in ("PyBitmessage", "MainThread"): return