1
我使用python版本libtorrent。将函数包装成线程并忽略严重错误
terminate called after throwing an instance of 'boost::lock_error'
what(): boost::lock_error
所以,我想我会换洪流相关功能到一个单独的线程,当它崩溃,它会杀死:当我运行与许多文件较长时间洪流会话,它与一个错误崩溃只是线程(而不是整个应用程序):
from threading import Thread
class TWrapper (Thread) :
# ...
def run(self):
try:
run_torrent_stuff()
except:
# print message
pass
t = TWrapper()
t.run()
t.join()
# check if all OK with t, if not - restart again
我认为,如果库崩溃,线程会死,我会join
它的主循环。但是,当libtorrent
崩溃,所有的应用程序死:(
为什么错误的线程之外升级?
(libtorrent
就是一个例子(现实生活),问题是一般)
'为什么错误在线程之外升级?' - 也许在其他线程上可能会引发异常libtorrent内部线程/池? – 2012-03-13 15:00:31