Last active
May 30, 2021 13:47
-
-
Save asssis/b2d091f9f4cb528229aa5f2b741103aa to your computer and use it in GitHub Desktop.
gerenciar processos por thread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array.each do |x| | |
puts '----------iniciando novo processo------------' | |
thread << Thread.new do | |
begin | |
Timeout::timeout(60 * 10) do | |
executar_processo(malha) | |
end | |
rescue | |
end | |
end | |
while(thread.select{|x| !x.blank? && x.status}.length >= 3) | |
sleep(10) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment