L
Logan Capaldo
Today I was thinking about how you could use a Thread + Continuation
to create a new thread with the interface of fork. Apparently I was
mistaken.
class Thread
def self.vfork
callcc do |cc|
Thread.new { cc.call(nil) }
end
end
end
thread = Thread.vfork
p thread
I don't know what exactly happens, but it definitely isn't
nil
#<Thread:1234>
as I was hopping
I could almost see just
nil
showing up but that's not what happens.
Instead I just get
#<Thread:1234 dead>
Anyone have a cool explanation?
to create a new thread with the interface of fork. Apparently I was
mistaken.
class Thread
def self.vfork
callcc do |cc|
Thread.new { cc.call(nil) }
end
end
end
thread = Thread.vfork
p thread
I don't know what exactly happens, but it definitely isn't
nil
#<Thread:1234>
as I was hopping
I could almost see just
nil
showing up but that's not what happens.
Instead I just get
#<Thread:1234 dead>
Anyone have a cool explanation?