Last active
October 25, 2017 16:31
-
-
Save apgordon/a8daec6ce620961bf50c3da9068d07db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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