1
0
forked from Mirror/wren

Don't allow calling the root fiber.

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.
This commit is contained in:
Bob Nystrom
2018-07-21 10:02:29 -07:00
parent 5f29a72d65
commit f23c82071a
11 changed files with 240 additions and 12 deletions

View File

@ -0,0 +1,8 @@
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()