简体   繁体   English

Python 两个或多个线程之间的关系/通信

[英]Python relation/communication between two or more threads

I'm new in Python, so I need some help.我是 Python 的新手,所以我需要一些帮助。

I created a server with我创建了一个服务器

SocketServer.ThreadingTCPServer SocketServer.ThreadingTCPServer

but my question is: Is there any way to communicate between two thread?但我的问题是:有没有办法在两个线程之间进行通信?

You can share a Queue http://docs.python.org/library/queue.html between the threads.您可以在线程之间共享队列http://docs.python.org/library/queue.html

Twisted is an event-driven networking engine written in Python and licensed under the open source (MIT license). Twisted是一个事件驱动的网络引擎,用 Python 编写,并在开源(MIT 许可)下获得许可。 You can use it for between thread communication.您可以将其用于线程之间的通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM