Ruby concurrency: Difference between revisions

From wikinotes
 
(No difference)

Latest revision as of 19:25, 17 February 2020

Documentation

thread docs https://docs.ruby-lang.org/en/2.7.0/Thread.html

Thread

def func1
   i = 0
   while i<=2
      puts "func1 at: #{Time.now}"
      sleep(2)
      i = i+1
   end
end

thread = Thread.new{func1()}
thread.join()