Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个项目需要与外部源建立 tcp 连接。每个工作线程都会向这个外部服务发送消息。
我想知道如何在不为每个请求建立和拆除连接的情况下做到这一点。我很确定 pymongo 模块做了类似的事情,但我找不到任何文档。是否可以设置某种线程安全队列并让单独的线程使用该队列?我知道我可能会为此使用 gearman,但我想避免在系统中有另一个移动部件。
uWSGI 有一个线程安全的进程共享队列系统(http://projects.unbit.it/uwsgi/wiki/QueueFramework)但是你确定使用简单的python threading.Queue 类还不够吗?