Revision: 80612
Updated Description
at March 23, 2020 05:07 by chrisaiv
Updated Description
https://www.chrisjmendez.com/2007/10/22/ruby-simple-example-of-threading/
Revision: 80599
Updated URL
Updated Code
at March 21, 2020 23:19 by chrisaiv
Updated URL
https://www.chrisjmendez.com/2007/10/22/ruby-simple-example-of-threading/
Updated Code
https://www.chrisjmendez.com/2007/10/22/ruby-simple-example-of-threading/
Revision: 4087
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 22, 2007 01:47 by chrisaiv
Initial Code
def func1 i = 0 while i <= 5 puts "func1 at: #{Time.now}" sleep(2) i = i + 1 end end def func2 i = 0 while i <= 5 puts "func2 at: #{Time.now}" sleep(1) i = i + 1 end end puts "Start at: #{Time.now}" t1 = Thread.new{func1()} t2 = Thread.new{func2()} t1.join t2.join puts "End at: #{Time.now}"
Initial URL
Initial Description
You can run functions in parallel without any problems as long as you have enough memory in your computer and none of your functions are dependant on one another. THink about how quickly you can complete your cron jobs now!
Initial Title
Simple Example of Threading in Ruby
Initial Tags
ruby
Initial Language
Ruby