From 5e8a64887472e0beaa045e7e5770dd68aa822fab Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Thu, 19 Sep 2019 15:18:51 +0800 Subject: [PATCH] [Fix] bug when __thread not created --- vnpy/rpc/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vnpy/rpc/__init__.py b/vnpy/rpc/__init__.py index d1b4877a..b74e1f4e 100644 --- a/vnpy/rpc/__init__.py +++ b/vnpy/rpc/__init__.py @@ -1,3 +1,4 @@ +from zmq.backend.cython.constants import NOBLOCK import signal import threading import traceback @@ -7,10 +8,11 @@ from typing import Any, Callable import zmq -_ = lambda x: x + +def _(x): return x # Achieve Ctrl-c interrupt recv -from zmq.backend.cython.constants import NOBLOCK + signal.signal(signal.SIGINT, signal.SIG_DFL) @@ -100,7 +102,7 @@ class RpcServer: def join(self): # Wait for RpcServer thread to exit - if self.__thread.isAlive(): + if self.__thread and self.__thread.is_alive(): self.__thread.join() self.__thread = None