而不是thread.start_new_thread(target=self.socketFunctionRead1())
尝试thread.start_new_thread(target=self.socketFunctionRead1)
因为有圆括号,函数被调用,函数的返回值被分配给target。由于thread.start_new_thread(target=self.socketFunctionRead1())可能是一个阻塞调用,因此只调用此函数。在
在thread.start_new_线程,目标应该是可调用的(一个行为类似于函数的对象)。在
编辑:thread.start_new_thread(function, args[, kwargs])
Start a new thread
and return its identifier. The thread executes the function function
with the argument list args (which must be a tuple). The optional
kwargs argument specifies a dictionary of keyword arguments. When the
function returns, the thread silently exits. When the function
terminates with an unhandled exception, a stack trace is printed and
then the thread exits (but other threads continue to run).
这意味着你应该打电话thread.start_new_线程(self.socketFunctionRead1). 在
如果您将关键字参数传递给start_new_thread,它们将被传递到self.socketFunctionRead1. 在
线程的目标是必需的,而不是关键字参数。在