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
1 changed files with 8 additions and 6 deletions

View File

@ -4,18 +4,19 @@ Helper Generic perform generic operations for threading.
Also perform some conversion operations. Also perform some conversion operations.
""" """
import socket import socket
import sys import sys
from binascii import hexlify, unhexlify
from multiprocessing import current_process
import threading import threading
import traceback import traceback
import multiprocessing
from binascii import hexlify, unhexlify
import shared import shared
import state import state
from debug import logger
import queues import queues
import shutdown import shutdown
from debug import logger
def powQueueSize(): def powQueueSize():
@ -58,15 +59,16 @@ def allThreadTraceback(frame):
def signal_handler(signal, frame): def signal_handler(signal, frame):
process = multiprocessing.current_process()
logger.error( logger.error(
'Got signal %i in %s/%s', '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, # on Windows this isn't triggered, but it's fine,
# it has its own process termination thing # it has its own process termination thing
raise SystemExit raise SystemExit
if "PoolWorker" in current_process().name: if "PoolWorker" in process.name:
raise SystemExit raise SystemExit
if threading.current_thread().name not in ("PyBitmessage", "MainThread"): if threading.current_thread().name not in ("PyBitmessage", "MainThread"):
return return