在Python2.7中,linux和os x在线程化smtpd方面存在奇怪的行为差异
我有一个线程smtp服务器,它在Linux(ubuntu 14.04和fedora 20)上的停止时间比在OSX(10.8)上的要多20秒 它发生在self.\u thread.join()行,我似乎能找到原因 有没有关于如何进一步排除故障的建议? 我通过执行以下操作来运行该文件:在Python2.7中,linux和os x在线程化smtpd方面存在奇怪的行为差异,python,linux,multithreading,macos,smtpd,Python,Linux,Multithreading,Macos,Smtpd,我有一个线程smtp服务器,它在Linux(ubuntu 14.04和fedora 20)上的停止时间比在OSX(10.8)上的要多20秒 它发生在self.\u thread.join()行,我似乎能找到原因 有没有关于如何进一步排除故障的建议? 我通过执行以下操作来运行该文件: from test import SmtpServer serv = SmtpServer() serv.start() serv.stop() serv.stop()是linux上速度慢得多的部分。根本原因是as
from test import SmtpServer
serv = SmtpServer()
serv.start()
serv.stop()
serv.stop()是linux上速度慢得多的部分。根本原因是asyncore.loop()需要在使用select而不是epoll的系统上设置超时。非常感谢@binarydud对此的帮助。事实证明,在thread.join上设置短超时也可以,但这可能会导致asyncore孤立 尝试将超时值设置为
self.\u thread.join()
-即self.\u thread.join(超时=0.5)代码>
from test import SmtpServer
serv = SmtpServer()
serv.start()
serv.stop()