J
James Gray
Am I understanding this example right:
#!/usr/bin/env ruby -wKU
printer = Thread.new do
10.times do
sleep 1
puts "Thread running in #{Process.pid}..."
end
end
fork do
p [Process.pid, printer.status]
printer.join
end
p [Process.pid, printer.status]
printer.join
# >> [457, "sleep"]
# >> [458, false]
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
__END__
Are all other threads stopped as part of a process fork?
James Edward Gray II
#!/usr/bin/env ruby -wKU
printer = Thread.new do
10.times do
sleep 1
puts "Thread running in #{Process.pid}..."
end
end
fork do
p [Process.pid, printer.status]
printer.join
end
p [Process.pid, printer.status]
printer.join
# >> [457, "sleep"]
# >> [458, false]
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
# >> Thread running in 457...
__END__
Are all other threads stopped as part of a process fork?
James Edward Gray II