Ruby concurrency

From wikinotes
Revision as of 19:25, 17 February 2020 by Will (talk | contribs) (→‎Documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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()