Python-BaseHTTPServer.HTTPServer并发&穿线 [英] Python - BaseHTTPServer.HTTPServer Concurrency & Threading
本文介绍了Python-BaseHTTPServer.HTTPServer并发&穿线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法使BaseHTTPServer.HTTPServer像SocketServer.ThreadingTCPServer一样是多线程的?
Is there a way to make BaseHTTPServer.HTTPServer be multi-threaded like SocketServer.ThreadingTCPServer?
推荐答案
您可以简单地使用这两个类的线程混合来使它成为多线程:)
You can simply use the threading mixin using both of those classes to make it multithread :)
虽然它对性能没有太大帮助,但是它至少是多线程的.
It won't help you much in performance though, but it's atleast multithreaded.
from SocketServer import ThreadingMixIn
from BaseHTTPServer import HTTPServer
class MultiThreadedHTTPServer(ThreadingMixIn, HTTPServer):
pass
这篇关于Python-BaseHTTPServer.HTTPServer并发&穿线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文