Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126679 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 203AE1A00BC for ; Sun, 9 Mar 2025 18:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741543839; bh=p6f32MhqalDcvqmkNe35nQSe+uKWFOh9W8R9UQeSZ9g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RfbhdQZKjVFmSfiPNmr+S1XJ0PfX3QIfAOgbWnLznPq5aAD8AaEgEYL2M3mDzVjmn cvOzDoVpmJ/mLiAb4Z07tW3ZevmdII/lE3JGWC1y/FD0UCbu0kvka1kfU/LPJrYbIV uNMb6hc3n1AEpujV5t8SzrlnUD0gVN0bRz3slik52ZDG4qrJPm5WwP3hVsKoNm8HPI aVIfQ4t5kx29hP7T2sm+bzCpCJBe4Sfz1BsBbffto/lNnCAu1B3lYVDoxH/I8Ln0gW aChiPwYAVdNaNViOa3oAyoTGM6kEN6al5/3qTDjtRMTiz90Xnzk32xbUfUMODw6h/D 0NTDgt68suclQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 75145180066 for ; Sun, 9 Mar 2025 18:10:38 +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-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 18:10:38 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e637edaa652so699105276.1 for ; Sun, 09 Mar 2025 11:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741543992; x=1742148792; 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=ybchtHnFuCBl8CptSa3xP/7oAPmbpkfg3wCtUaDc5cE=; b=hvuitEMG6s6v6v7B6XCRml+pudamQLlITGgMoSHhD42osdqs3GCax9m098zwG+akCf 7qJpnx9riewCCyaMggH5EfQnB7Cvml7mAHy2ABAdoztxvJpksZFsCZ6SEUF74SwbYs61 dYoEreQgcncQ0OWWkJ2diwdLVY+JE0RB0yrCCIeDJZ2B0aJ5pBGpfWWNlBm7UTta7zYD 2rp1XHpqImb9gVHUh84+fs4M8+hZSy6MFTtmy9vIPtfZ9IvsI28MsD7nEXPIhp1mNotd fYe2F8dIHtMlhtUA7YS9FWr/nw6+D3/3ktJAoqEr2MWqzbl2HXf8+W18Ck50OkPFo7NB JcxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741543992; x=1742148792; 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=ybchtHnFuCBl8CptSa3xP/7oAPmbpkfg3wCtUaDc5cE=; b=DfJD3lHr+LVL8AqbMaPItur7BDC5mSg4WS/n/1e8hUWcrlMCgQiNRdP8GIXK+xdjoz WVCt2Xp10lY8z20ed5IB4vMinZtt0DeTSOmBIyrphu6WUOfPY2NfyXm0hWhgTzFuLtJw P6Yqb0CNiV8E1Xeued9dXluUoREcmZ7iIc6dT9lJn+JOfEqUPBbfCG3ilDrd8QteucGi kaKe+ijZJmKpW3ugIZ8oAR/ghzW/1qSGyL2ntX1wiDzfO6LN1ggqWr+0arDOkSSTZA8W LfLWB7R2Z03MPS98/+ea7SOw5q2PtPXNtJitseY5ZyB4hfxJHFNVO0BDY+Gs+vFjRWWu iuPw== X-Gm-Message-State: AOJu0YyCSkjdmZ4ytcwZrasO1HwvvLRxoDiHVBq2XhWJaVjHY51azPdT jHfdEguUJT1cTg184x8CpWrXGSCHdJtlHzg1k6VXSf3ZHil3SJ154t4f7yZlfLWiGw+v7qQcWGX qH3JeK1mhTUGtjfQwUTELzhIpnTM= X-Gm-Gg: ASbGncsxT6xhbFGQQQtXIr2ZTTP+8hnclURRbWRNvvep6JSDtPOFNuj+VaETxXoped7 RlGfaZWdQE1TeOKlWsfNxKkDgorUQhB3HCiWbQ2omBjmczF8vZceWeVmszYv2nVKbvwyWTHNBMW z9XmGBlMvoiRLi+O7QmL5A/rB1QQ== X-Google-Smtp-Source: AGHT+IGeuHyj1U9CypAE5Fd9dsNAAcq3qCxAI0682FMmukOAoQ4vPlxoKg1gcw0wFHHTURTC6vU/QlQjcmIeQYtyW/c= X-Received: by 2002:a05:6902:2702:b0:e5b:1453:d2e4 with SMTP id 3f1490d57ef6-e635c143e65mr13829027276.11.1741543991947; Sun, 09 Mar 2025 11:13:11 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <1b6a5b3b-be9b-4e46-9cc6-b8b7f57b8494@app.fastmail.com> In-Reply-To: Date: Sun, 9 Mar 2025 20:13:01 +0200 X-Gm-Features: AQ5f1JoUTYR0cYF-lky8ibwJzZPv4XEqY8dxLYmRvJa1VXZGpSoC70VTyPXss-I Message-ID: Subject: Re: [PHP-DEV] Re: PHP True Async RFC To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000003c44062feccf05" From: edmond.ht@gmail.com (Edmond Dantes) --000000000000003c44062feccf05 Content-Type: text/plain; charset="UTF-8" > > I think the same thing applies to scheduling coroutines: we want the Scheduler to take over the "null fiber", > Yes, you have quite accurately described a possible implementation. When a programmer loads the initial index.php, its code is already running inside a coroutine. We can call it the main coroutine or the root coroutine. When the index.php script reaches its last instruction, the coroutine finishes, execution is handed over to the Scheduler, and then everything proceeds as usual. Accordingly, if the Scheduler has more coroutines in the queue, reaching the last line of index.php does not mean the script terminates. Instead, it continues executing the queue until... there is nothing left to execute. > > At that point, the relationship to a block syntax perhaps becomes clearer: > Thanks to the extensive discussion, I realized that the implementation with startScheduler raises too many questions, and it's better to sacrifice a bit of backward compatibility for the sake of language elegance. After all, Fiber is unlikely to be used by ordinary programmers. --000000000000003c44062feccf05 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>
>=C2=A0 I think the same thing applies to scheduling coroutines: we want the Schedu= ler to take over the "null fiber",
>

= Yes, you have quite accurately described a possible implementation.
When a programmer loads the initial index.php, its code is alr= eady running inside a coroutine.
We can call it the main coroutine or the root coroutine.

When the index.php script reaches its last instruction, the= coroutine finishes, execution is handed over to the Scheduler, and then ev= erything proceeds as usual.

Accordingly, if the Scheduler has more coroutines in the queue, reaching= the last line of index.php does not mean the script terminate= s. Instead, it continues executing the queue until... there is nothing left= to execute.

>
>=C2=A0At that point, the relationship to a block syntax perhaps becomes cle= arer:
>

Thanks to the extensive discussion, I rea= lized that the implementation with startScheduler raises too m= any questions, and it's better to sacrifice a bit of backward compatibi= lity for the sake of language elegance.

After all, Fiber is unlikely to be used by ordinary pro= grammers.

--000000000000003c44062feccf05--