On Mon, Feb 17, 2025, at 20:31, Edmond Dantes wrote: > > There should be no perceptible difference between a blocking sleep(10) and > > an async sleep(10), so what backwards compatibility are you referring to? > > For example, the behavior of the code below will not change. The code will > execute sequentially, and context switching will only occur when > `resume`/`suspend` is called. > > However, when the `Scheduler` is activated, this behavior changes. Now, > calling `sleep()` inside a `Fiber` will lead to a context switch. > > If the activation of the `Scheduler` is implicit, previously written code may > not work as the developer expects. > > > <?php > > $fiber = new Fiber(function (): void { > echo "Start fiber\n"; > sleep(1); > Fiber::suspend("Paused"); > echo "Resume fiber\n"; > }); > > $result = $fiber->start(); > > echo "Fiber suspended with: $result\n"; > > sleep(10); > > $fiber->resume(); > > echo "Fiber finished\n";
I think what bilge was trying to point out is that there should be absolutely no change on existing software with or without the scheduler running (for software not using fibers). — Rob