我正在调用Python中的一个函数,我知道它可能会停止并迫使我重新启动脚本.
如何调用该函数或我将其包装成什么,以便如果它花费的时间超过5秒,脚本会取消它并执行其他操作?
python multithreading timeout python-multithreading
我有功能f; 我想在启动f之后抛出异常1.我无法修改f().它可以在c ++中完成吗?
try { f(); } catch (TimeoutException& e) { //timeout }
c++ time timeout c++11
timeout ×2
c++ ×1
c++11 ×1
multithreading ×1
python ×1
python-multithreading ×1
time ×1