forked from Mirror/wren
The VM used to not detect this case. It meant you could get into a situation where another fiber's caller had completed. Then, when it tried to resume that fiber, the VM would crash because there was nothing to resume to. This is part of thinking through all the cases around re-entrancy. Added some notes for that too.
13 lines
312 B
Plaintext
13 lines
312 B
Plaintext
class Test {
|
|
static run() {
|
|
var root = Fiber.current
|
|
System.print("begin root") // expect: begin root
|
|
|
|
Fiber.new {
|
|
System.print("in new fiber") // expect: in new fiber
|
|
root.call() // expect runtime error: Cannot call root fiber.
|
|
System.print("called root")
|
|
}.transfer()
|
|
}
|
|
}
|