thread - python 线程,消息处理系统。怎样在维持主线程的同时结束掉子线程?
天蓬老师
天蓬老师 2017-04-18 10:19:26
0
1
775

写了一个类似于消息处理系统
主线程是监听端口,有消息过来就打开一个新的子线程,如果子线程遇到错误怎么退出呢?杀死掉这个子线程但是维持主线程依旧监听端口?
我用的是threading 谢谢!

threading.Thread(target=login.login, args=(vrc_waite,username,password,phone,), name=username).start()


天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
巴扎黑

The child thread should exit by itself. If you are using a socket, the main thread must create the socket listener. After receiving the message, it creates the socket client and then passes it to the child thread. The child thread operates on the client. If an error occurs, it will not affect the listener

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template