PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my settings
my profile
Public Pastes
How can I get noti...
0 sec ago
Untitled
4 sec ago
Fetch-and-add usin...
5 sec ago
Dotinha
6 sec ago
Fetch-and-add usin...
6 sec ago
Why doesn't Django...
11 sec ago
Untitled
12 sec ago
Untitled
13 sec ago
Untitled
By: a guest on Jan 28th, 2012 | syntax:
None
| size: 0.29 KB | hits: 23 | expires: Never
download
|
raw
|
embed
|
report abuse
Copied
#!/usr/bin/env ruby
require 'thread'
AllMyLittleThreads = []
def foo
AllMyLittleThreads << Thread.new do
loop do
puts "foo"
foo
end
end
Thread.current.exit
end
AllMyLittleThreads << Thread.new { foo }
AllMyLittleThreads.each { |thread| thread.join }
create a
new version
of this paste
RAW Paste Data
#!/usr/bin/env ruby require 'thread' AllMyLittleThreads = [] def foo AllMyLittleThreads << Thread.new do loop do puts "foo" foo end end Thread.current.exit end AllMyLittleThreads << Thread.new { foo } AllMyLittleThreads.each { |thread| thread.join }