Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python2.7中,linux和os x在线程化smtpd方面存在奇怪的行为差异_Python_Linux_Multithreading_Macos_Smtpd - Fatal编程技术网

在Python2.7中,linux和os x在线程化smtpd方面存在奇怪的行为差异

在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

我有一个线程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上速度慢得多的部分。

根本原因是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()