2013年3月29日

python中threading方式创建的线程的终止

摘要: 对于采用threading方式创建的线程,没有提供推出的方法,只能是等线程函数结束。但是有些情况需要强制结束,这就比较麻烦了。有如下实现方式:import threadingimport inspectimport ctypes def _async_raise(tid, exctype): """raises the exception, performs cleanup if needed""" if not inspect.isclass(exctype): exctype = type(exctype) res = ctype 阅读全文

posted @ 2013-03-29 23:03 rainduck 阅读(21731) 评论(1) 推荐(1) 编辑

导航