Skip to content

Instantly share code, notes, and snippets.

@apgordon
Last active October 25, 2017 16:31
Show Gist options
  • Select an option

  • Save apgordon/a8daec6ce620961bf50c3da9068d07db to your computer and use it in GitHub Desktop.

Select an option

Save apgordon/a8daec6ce620961bf50c3da9068d07db to your computer and use it in GitHub Desktop.
def func1
puts "Creating villager... "
sleep 4
puts "Villager Created!"
end
def func2
j = 0
while j<=5
puts "simultaneous function running at the same time (stamp: #{Time.now})"
sleep(1)
j = j+1
end
end
t1 = Thread.new{func1()}
t2 = Thread.new{func2()}
t2.join
t1.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment