1
是否有可能捕獲一個SIGINT來阻止Julia程序運行,但以「有序」方式執行?在JuliaLang處理SIGINT
function many_calc(number)
terminated_by_sigint = false
a = rand(number)
where_are_we = 0
for i in eachindex(a)
where_are_we = i
# do something slow...
sleep(1)
a[i] += rand()
end
a, where_are_we, terminated_by_sigint
end
many_calc(100)
說我要結束這至關重大30秒,因爲我沒想到它會這麼長的時間,但不想扔掉所有的結果,因爲我有另一種方法,從where_are_we-1
繼續。是否可以儘早停止(輕微),但是使用SIGINT信號?
這麼簡單,不知道這是可能的。謝謝 – pkofod