helper_generic: imports in alphabetical order, import multiprocessing

This commit is contained in:
Dmitri Bogomolov 2018-04-18 14:22:00 +03:00
parent 4cf73675c2
commit 74ddda8775
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -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