尝试thread
在 Python 中使用时,使用以下代码
import select, sys, time, thread
TIMEOUT = 30
def listenthread(server,result):
# some code
#
#
def main(argv=None):
if argv is None:
argv = sys.argv[1:]
server = Server()
clientaddrs = []
# listen to clients in new thread
thread.start_new_thread(listenthread, (server,clientaddrs)) # that line produces a problem
Undefined variable from import: start_new_thread
当我到达线路时我得到:
thread.start_new_thread(listenthread, (server,clientaddrs))
可能是什么问题?
问候