Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubyfibers and the schedulerSingle-choice MCQ

In MRI, `Thread#[]`/`Thread#[]=` and `Thread#thread_variable_get`/`thread_variable_set` differ in an important way once fibers are involved. What does this program print?

Thread.current[:k] = "outer" Thread.current.thread_variable_set(:k, "outer-tv") Fiber.new do p Thread.current[:k] p Thread.current.thread_variable_get(:k) end.resume