Last active
August 29, 2015 14:13
-
-
Save mauricio/826542a4abe1b068a70e to your computer and use it in GitHub Desktop.
This file contains 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 fib( n ) | |
return n if ( 0..1 ).include? n | |
( fib( n - 1 ) + fib( n - 2 ) ) | |
end | |
threads = [] | |
4.times do | |
threads << Thread.new do | |
fib(50) while true | |
end | |
end | |
threads.each do |t| | |
t.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment