Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126671 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 1A2EF1A00BC for ; Sun, 9 Mar 2025 09:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741512468; bh=LVSIvxbwUb6bd8c1ojrVxMqQrJnEqmbp7uu0ByajzB0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=duWmHzCPj8LdGNkgD/tr6FCucvoc4x6KMQJN8x8zarx7SaD+PWtW7MmEfHZu1YKlS LdoyH9pAvZ2RUqyNrFKJCuQS1R5qkbSRQvYMItp9m3MoYOkEhSIhNCRqZ6j0Az9iJX afb0V9OnD5Bo0fI8ZDJufQF5gN4/+66kItGRl7cm1+WDAqKqQKwn0sJK7FYRS29BZN /Xx24e5otLyvjk+maOxgq3XIRtz6/AtbwDsG2AypxnIiP+xt8/InXTFfx3rZys25mT VQ2IAndFLeqwgmvevWtvQDPcT8ZkYWBgNKz/EkpjI72NW7XJ0AzYGQaiRc/X3ZZEfy KUnVyjGlPxoHw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 332CB18007E for ; Sun, 9 Mar 2025 09:27:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 9 Mar 2025 09:27:46 +0000 (UTC) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e60cab0f287so2223401276.0 for ; Sun, 09 Mar 2025 01:30:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741512621; x=1742117421; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qdLuZKbcOGToq2f6RJtK39GBo//ui/jeF1Y7PYK9J9Y=; b=S2aJQ//vSw4YsplM29iHIRxQwMba9wpQO8lJrg2kunKIMtqkpLa8FZcF/azu/FC/9h dx+iJXw3djrFVGUgr1p/xQYEdk2l+KgNfwGbYfxAcXCJw3lt90yGwvjN4l1K0pNnOTz4 0oP3v0PnUrCdbxiAgN75EXuNgkN4I/Uszq7oAtojCjz227qmBKaR5SxH9TmEJ6/mp6iB 9SwffTVE14x+YyWmGuPIjhAlBlWcZaSwvUwsgtwXPbN+M4+JSceV5nnxwJsmIrKEuhML Q8Y2qZALHv24aZibF28fo+6BZ5bzKyXmK4IgPVzOraIr1xP91H4YrdgCEo/Q6+VqJ6p1 0ByQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741512621; x=1742117421; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qdLuZKbcOGToq2f6RJtK39GBo//ui/jeF1Y7PYK9J9Y=; b=AkKMMQq1nUe+mSwCeXJxnT+5bnee/ubymdvUbSJkQ40y2yinUfc9I+MX1Mem3mEAPa BMOvzcxp1ntQVRV8dWPya3a+f6vC8D0xTT1IwPGGvjcMEknsVmceM1W91UnQ/f6kn46i aRxXtxOzIH7UCZCZWA/JMcXLnR4QLLO0SoNWpWgBbw47apZnnlZvopXJqYUm62nYElHW t0ZMi8jl2US9/VB8NBwQvvfKVArx/FR8BzgpVw32W+O8JVyRWU9jDOmYMS42zT3CaNzx SVaz05JnRFaF69wPHTdmnN5lOtPGa80Bid//5F1P7FEINyGyNZ6GSyFG/i8d5HZH3I5r VPXQ== X-Forwarded-Encrypted: i=1; AJvYcCUS3+ML2vGIw6R9Ejo90koD2NBnFDGbwjhtpeJEmOp07+R7OIx/fjb/47LeT/UocR2iLt5qlx2uG5Q=@lists.php.net X-Gm-Message-State: AOJu0YxfFY4RlotwUpbdRxlbmMfPHFMYLaAkyyKagRuumYSqRVnshwpz 2L9ZoUiDqi3EqHzamKJVeN5KMDYuDqYjwbMsTkZbVP2y6dfKLgpw3C/7HZp73qx2Vgod5oiva4Z MozMITiWTuiZxo/ROVSHOopqYd2tol0nLudM= X-Gm-Gg: ASbGncvvGyN3u5Tbs7Acn+6buaO8I3E4Q78010Nug6kahWf0uVrWlceRSfmqdClVcoe FrnMi43kJfrj6b5ccq8iLf0J2ar1C0skDwre9Roc5gJl4GetW85susV5M/2ZU7X5/P+pM3WBjea IUTzdtq12ojHjpxKZk5Pp1h1vDYw== X-Google-Smtp-Source: AGHT+IEosyomolFPJ4yVYs5jw4bQag7CBKUA7n8DtIQ6bE3yG6rnWn3ZUlwBGX/5vhqXlMPHvjb1gPGj4s2liQRtASM= X-Received: by 2002:a05:6902:100d:b0:e5d:d016:989e with SMTP id 3f1490d57ef6-e635c1d7dafmr12024466276.39.1741512620812; Sun, 09 Mar 2025 01:30:20 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <9964db8c-0ffe-43d5-8246-47fc76b07180@app.fastmail.com> <78a03dd0-fd4a-4f4a-ad8a-37e5704f06fc@app.fastmail.com> <08c8ad0b-e8f4-46e3-99f0-b80748d40b89@app.fastmail.com> <07973EAE-2D83-47A8-8FA0-84286C77C02B@rwec.co.uk> <48d66433-3ae9-4895-8361-7c81a0a3670d@app.fastmail.com> <8599eb8b-d4a3-4cb8-899a-25b134e0d64d@gmail.com> <74c4c726-63aa-44e0-84c9-840e13a65a4f@gmail.com> <9b7ab30f-5ed6-400d-b941-1291e9185286@app.fastmail.com> <9a2e81e8-3534-455b-879a-5a45c85b3ba7@gmail.com> In-Reply-To: Date: Sun, 9 Mar 2025 11:30:10 +0200 X-Gm-Features: AQ5f1Jodjhvyi_Nhu6LNiUK-fAOAme17Ajz02tdhz4EeKKlR17pYkcsM8Yq3FxM Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= Cc: Daniil Gentili , PHP internals Content-Type: multipart/alternative; boundary="00000000000022b9b4062fe5810b" From: edmond.ht@gmail.com (Edmond Dantes) --00000000000022b9b4062fe5810b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > Have a different method `Fiber::suspendToScheduler(Resume $resume)` that would return the control to the Scheduler. > That's exactly how it works. The RFC includes the method Async\wait() (Fiber::await() is nice), which hands control over to the Scheduler. At the PHP core level, there is an equivalent method used by all blocking functions. In other words, Fiber::suspend is not needed; instead, the Scheduler API is used. The only question is backward compatibility. If, for example, it is agreed that the necessary changes will be made in Revolt when this feature is released and we do not support the old behavior, then there is no problem. > > Maybe that is what we need: to be able to return control both to the parent fiber for custom logic that might be needed, and to the Scheduler so that the language would be concurrent. > 100% yes. > > As for userland event loops, like Revolt, I am not so sure they fit with the new language level async model. > Revolt can be adapted to this RFC by modifying the Driver module. I actually reviewed its code again today to assess the complexity of this change. It looks like it shouldn=E2=80=99t be difficult at all. The only problem arises with the code that has already been written and is publicly available. I know that the AMPHP stack is in use, so we need a *flow* that ensures a smooth transition. As I understand it, you believe that it=E2=80=99s better to introduce more = radical changes and not be afraid of breaking old code. In that case, there are no questions at all. > --00000000000022b9b4062fe5810b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>
> Have a different method `Fib= er::suspendToScheduler(Resume $resume)` that would return the control to th= e Scheduler.=C2=A0
>

That's exactly how = it works. The RFC includes the method Async\wait() (Fiber::await() is= nice), which hands control over to the Scheduler.
At the PHP core level, there is an equivalent method used by all blocking f= unctions. In other words, Fiber::suspend is not needed; instea= d, the Scheduler API is used.

The only question is backward compatibility. If, for example, it is agre= ed that the necessary changes will be made in Revolt when this feature is r= eleased and we do not support the old behavior, then there is no problem.

>
>=C2=A0 Maybe that is what we need: to be able to return control both to the parent= fiber for custom logic that might be needed, and to the Scheduler so that = the language would be concurrent.
>

100% yes.

>
>= ;=C2=A0 As for userland event loops, like Revolt, I am not so sure they fit with th= e new language level async model.
>

Revolt can be adapted to th= is RFC by modifying the Driver module. I actually reviewed its= code again today to assess the complexity of this change. It looks like it= shouldn=E2=80=99t be difficult at all.

The only problem arises with the code that has already been written = and is publicly available. I know that the AMPHP stack is in use, so we nee= d a flow that ensures a smooth transition.

As I unde= rstand it, you believe that it=E2=80=99s better to introduce more radical c= hanges and not be afraid of breaking old code. In that case, there are no q= uestions at all.

=

--00000000000022b9b4062fe5810b--