Closed
Description
Description
Right now, when trying to suspend the current fiber in a destructor, the engine throws "Cannot switch fibers in current execution context".
This has been discussed a bit with @trowski and @kelunik in nicolas-grekas/symfony#43 (review)
From that discussion, the reason is that the garbage collector would need to be made safe for re-entry from multiple fibers.
Not being able to do i/o (which is what fibers are most useful for) in destructors kinda reintroduces the “What color is your function?” problem, which fibers were designed to avoid.
I totally get that this might be challenging, but this limitation should be removed if possible. 🙏