Re: PHP True Async RFC

From: Date: Sat, 08 Mar 2025 22:13:10 +0000
Subject: Re: PHP True Async RFC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message


On 8 March 2025 21:42:21 GMT, Daniil Gentili <[email protected]> wrote:
>
>To make an analogy, it's like saying PHP should have an io {} block, that makes sure all
>file resources opened within (even internally, 10 stack levels deep into 3 libraries, whose
>instances are all used after the io {} block) are closed when exiting.

Traditional PHP offers exactly this: the SAPI lifecycle tracks all file handles opened within a
request, and closes them cleanly before reusing the thread or process for another request.
Essentially what I'm proposing is a way to implement the same isolation in userland, by marking
a checkpoint in the code.

As I've said repeatedly, it doesn't necessarily need to be a mandatory restriction, it can
be a feature to help users write code without having to worry about *accidentally* leaving a
background fiber running. 

Rowan Tommins
[IMSoP]


Thread (110 messages)

« previous php.internals (#126662) next »