Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129394 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 lists.php.net (Postfix) with ESMTPS id 38D421A00BC for ; Sat, 22 Nov 2025 13:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763819750; bh=2vzG8UPcjnQVo8eIKCuvUeLT39/uq7uoSGdZek1Tq0w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=eb2k+5iOm9kGg1hoUmZ6hHumKiJVKEjG7d30RCOGumq6HBrBKZpjAtpX+XlgWNThD yHGjYDERdnXq2xd92OHJwS3VdiE/PA5ZQz7EeOcwojMYFHd/02LaEFZfVFvwCXVRg9 /BPFl2hPy7Wc/HT9D5PtK3OVtt6rJHZ6HR+8SDsUh7muoV2XG3jn3rqD6cEBgvGhpZ tWpw9QsHed72ljybt7iDCpIHmxq65LpMsbbq/W/iZIZLxOjXxIg21AdXKXJnFdKQBa Ge6fvuoR4BZ22u2OiXLQXrePk2vHVkVFPiBZrPt4zgaVVROEr46XfQPFVgmLXsQzbB xcmnr0HwNnNUQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B9681801D6 for ; Sat, 22 Nov 2025 13:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 ; Sat, 22 Nov 2025 13:55:49 +0000 (UTC) Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-5dbe6304b79so1084094137.3 for ; Sat, 22 Nov 2025 05:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763819744; x=1764424544; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QRp7OdU2gQHCAZMzSAQuV1JiOFk8XgnsxkC4gVU2qb8=; b=BvJkblWRAG4CnzuI6628/4c9g/sBMk9URg7BZEkyOmmruGeeFPqs+j7kihmAsQPXQ0 TJpvKUNBA4s/NSVf+tJTdxaUXDh0A4NPFfj7leAkpFw3EhauS9+MxECHQf65BDaNcHmK bEOKFPt6jooSpZm3XrdxI9yA6WlMZQKpRvr7HBDJr6O4orZEg2PgwIvNvq7xSHhm31KM SbNRqctPNwSeU9fkOY83OP5sfgAgAFThMxF8GInAxubGrU4WOlFlqGajNVIwVuXUfrVG iuDa16f1SzwwLQ+E6pBm8Gk7akS5Tvovx0svHY1CFjAF4vkrhPArMrFFmcMEmhkxvKCt e43g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763819744; x=1764424544; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QRp7OdU2gQHCAZMzSAQuV1JiOFk8XgnsxkC4gVU2qb8=; b=Re+qvZ4u4Rymp+axRDhCC+lu2kIg+x1X7ZH56qYGMXcG6gND62Zka0JeV+F3G9izGx C4HwcS7pmD31+2HjUGeerZXta0Ev45Shz60MbPAm8ypydT4RK2uWEHc06rWoUKxzRX0u tPx+X5UqiBg2XExE3hVHJTJRO4CNl7pE9NHdjzf5v17JKDEBIWIJzNQl4Lv6/18AlL/s Mh617h48Pv0TJRV4sypy03dzqrSz74TaB4GzyhTyMMyhn5KEzjfriWKvgF+MAYQuGHdK zYgqIy1T2o8/zTFCISsU+iGEJAn/EEDe6yczOQr6yJuGCUjzzlNWGnaJyuyXM232yFLC mKKA== X-Gm-Message-State: AOJu0YwLujw5i4U4ffteV4CPqhSLAW3r1rtqiOH6pYAXVsVsC47wvadh 58MIsNhcBvV9Tnd6l4WH9sVtkuoRt7quPAJQ8YlwiunqKn8KaZ800cVNzp6SR1MnYgz/yznnYUB V/BRSD1cTZeFYUPa6RHzrNA7N4Faq7FfCjtr/E9U= X-Gm-Gg: ASbGncseSh2dCN+NzqJV7PAIKZ//Zw9tk6vtIOf5NO85ga9Xe6ceJl2DYQ3c8AyNYWJ SFuTzb0JXxF7Ss7LtGLTCgz19yR8T2UB8mO/3tv2vci4KebSblcAmsUPo3Cwu8PmjgiAjbpilvu UzLIZ+vYC9evOtuZjZDk9Ztv18999cA38Z/WZIsPS74YEyjlPt6HlEgqlbL9MIg/RsaXTwB0GbS PTrDi76GF4OGuabKyZss2inWSIWKAimQLMoE6E3SWTRc6lMMOkX8q78AdsklR5U8BX7tuC98tRg 38g14wh2YT5XODevkF0OimbM X-Google-Smtp-Source: AGHT+IEQ/tLG6+rhoNC2aOdP4qEHlib8mmKVx3pIc4aZ0lm+vLC+ZRT4M+Kfvwr6l/aOyu3hZ1bBLkLF7CPB6Ry18z4= X-Received: by 2002:a05:6102:441f:b0:5df:b4a8:fbaf with SMTP id ada2fe7eead31-5e1de3a29f4mr1731099137.31.1763819744163; Sat, 22 Nov 2025 05:55:44 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <383528143.397454.1763760932585@email.ionos.de> <691963327.399484.1763796022993@email.ionos.de> <1402906904.784903.1763811759896@email.ionos.de> <2015208655.784984.1763811978476@email.ionos.de> <980296152.1071.1763813573083@email.ionos.de> <92865666.4510.1763818506332@email.ionos.de> In-Reply-To: <92865666.4510.1763818506332@email.ionos.de> Date: Sat, 22 Nov 2025 15:55:32 +0200 X-Gm-Features: AWmQ_bk02SBfnafzoTsokJdK4mjuRx73_VTocowmzAtBxWgMHsglybUoz09lRUQ Message-ID: Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 To: Thomas Bley Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) > So I guess you want to use spawn() in a similar way as call_user_func() w= orks. yes > This changes the behavior of file_get_contents() from the outside No. ```php function file_get_contents(string $filename): string { $fh =3D fopen(); // It creates an EPOLL event so it can wake us when the data becomes available. $event =3D ReactorAPI.create_event_from($fh); $waker =3D Scheduler.getCurrentWaker(); // Event Driven logic inside. $waker.add_event($event, function() use($waker) { // Wakeup this coroutine $waker.wake(); }); // suspend current coroutine // zz..... z..... Scheduler.suspend(); // Continue here after the IO event // Now we have date, return return fread($fh, ....); } ``` This is pseudocode. You can assume it always works. If you call `file_get_contents` directly, it behaves the same way. So it does not matter where `file_get_contents` is called. Since all PHP code together with TrueAsync runs inside coroutines, `file_get_contents` will suspend the coroutine in which it was invoked. When you call `spawn`, you simply run the function in another coroutine, not in your own. But `spawn` has no effect on `file_get_contents`. We=E2=80=99re not at risk of DataRace yet :) We don=E2=80=99t have multithr= eading. And most likely it won=E2=80=99t appear anytime soon.