Created
June 28, 2021 12:49
-
-
Save freakflames29/a5bf1191da8e82c84bf0468057cef533 to your computer and use it in GitHub Desktop.
Thread in ruby
This file contains 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
# t=Thread.new{puts "okj"} | |
b=Thread.new{puts "lvoe"} | |
# threa=[] | |
# 5.times do | |
# threa<<Thread.new{puts "mang0"}; | |
# sleep(2) | |
# end | |
# threa.each(&:join) | |
# puts "Hllp" | |
#thread error | |
# Thread.abort_on_exception=true | |
# begin | |
# t=Thread.new {raise "hell"} | |
# rescue RuntimeError | |
# puts "yeah gotcha" | |
# end | |
# t.join | |
# puts "done" | |
# Thread pool | |
pages=%w(index contact) | |
pages.each{|x| t=Thread.new{x}} | |
t.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment