History log of /php-src/Zend/tests/fibers/destructors_009.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 3c56af99 21-Feb-2024 Arnaud Le Blanc

Allow fiber switching during destructor execution

Fiber switching was disabled during destructor execution due to conflicts
with the garbage collector. This unfortunately introduces a fu

Allow fiber switching during destructor execution

Fiber switching was disabled during destructor execution due to conflicts
with the garbage collector. This unfortunately introduces a function color
problem: destructors can not call functions that may switch Fibers.

In this change we update the GC so that Fiber switching during GC is safe. In
turn we allow Fiber switching during destrutor execution.

The GC executes destructors in a dedicated Fiber. If a destructor suspends, the
Fiber is owned by userland and a new dedicated Fiber is created to execute the
remaining destructors. Destructor suspension results in a resurection of the
object, which is handled as usual: The object is not considered garbage anymore,
but may be collected in a later run.

When the GC is executed in the main context (not in a Fiber), then destructors
are executed in the main context as well because there is no risk of conflicting
with GC in this case (main context can not suspend).

Fixes GH-11389
Closes GH-13460

show more ...