在 twisted 中启动线程后,发现 Ctrl-C 失效了,signal 没有正确被处理。
----------------------------------------------------
from twisted.internet import reactor, threads
import sys, signal
def doLongCalc():
print "hello"
threads.deferToThread(doLongCalc)
reactor.run()
----------------------------------------------------
找了半天,按 Guido 老大而言,是 FreeBSD 对 signal 处理的 bug。
"Well okay than I can confirm that OSX is *not* affected by this OSbugginess."
http://bugs.python.org/issue1975
- -! shit,用 twisted 我还不能用多线程了。
评论