Created
August 29, 2012 20:38
-
-
Save aalvesjr/3518595 to your computer and use it in GitHub Desktop.
Brincando com Threads no Ruby
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
| t1 = Thread.new do | |
| puts "Na thread 1" | |
| sleep(6) | |
| puts "ainda na thread 1" | |
| sleep(3) | |
| puts "fim da thread 1" | |
| end | |
| t2 = Thread.new do | |
| puts "Na thread 2" | |
| sleep(8) | |
| puts "Outro puts da thread 2" | |
| sleep(12) | |
| puts "fim da thread 2" | |
| end | |
| while(true) do | |
| puts "Aguardando threads" | |
| sleep 5 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment