Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129694 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 306C31A00BC for ; Fri, 26 Dec 2025 18:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1766772707; bh=a6PtRRn2+fymYGl7/aO7Ak6wU/44QTQrbdv7alESHCY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lsUViZgib0Vly5Lb/BbDuqLHVL5Xiceqhx0urZdsK45sSUqdt72bmaWaiwyYGtBwN JoFPNLnf/C3v/SlUSXVs5FH8ZbbEDpMD0OLP1GBEWNX3NBQ/lP5YABjWfBryBfuCtK FFHx8OTxNiZ11F6u1+qQeHA2zgAaE+bgiaXd36BmYC682AcPw0aVdcXNWdY3ubUtg5 b8Fy+uJ7gFZgNKy3BfkGaZDO7GWC9rj7IvDGFiN3/llIt7smk22dWbhvV7+G8aLnRO RjzHBP/yGG9tGkj22yWMDrChOX9gSzQQX37PFySTKDg+rRNzjxV/rsd+/TBzqfQv5R aCdkS+yDyMVBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9DC3A180050 for ; Fri, 26 Dec 2025 18:11:41 +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=1.8 required=5.0 tests=BAYES_50,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 ; Fri, 26 Dec 2025 18:11:41 +0000 (UTC) Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-7c6d1ebb0c4so5122609a34.1 for ; Fri, 26 Dec 2025 10:11:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766772696; x=1767377496; h=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=a6PtRRn2+fymYGl7/aO7Ak6wU/44QTQrbdv7alESHCY=; b=SfHXTjaf2NIlj092skmWAx9wU1PQaY21RL/pMdnouF4G3XHcOicJUrnucjjFkNJuCM 3LoP5fNEjLR5IOsvlJ3QdDAohYA0FsrkXS6QHMLO+qM4cA/Tn+mmuoy4yxu2FPG+u2hy zGEERVkXZrXVZ7W11gEfRrDfueLkSkhZ7AtNufOoPat58gd+tYp0LJ7MBaZ6AdbY1I8A T6KhNTSfDD90S5KHXNJ1wF0/XaY05VxC03UviaC1dNqoZQNhfCf8HJ4LC3G5I6UgUxWp UxkyehmZh6OrAC5FLFTtdSD3DEdfD5jqv5rhAh/oPC/M1sLLr3CT6TxDE+2VGKQJZhMO LzgQ== X-Gm-Message-State: AOJu0YwfyMPy+HaToa6WdopIl7A2wNeRWs9+SIR5+bQsVmuH+iqm4zLg TCcuL1A/eSr359oQgBnM4Gl2hFkdLHjxSx63x8TA+fgvm26qovgrso+EjMwQdL7WPIG2CF6nb2K AMowP4R6MOvAL/4VgrLqb6zSI6h5lnTY= X-Gm-Gg: AY/fxX65xyIpQ8XnAmW7nMjclVwOGk24a52YzbtQLexifVCCiSdSnDGrRIcbt6RFZZq KWlT7EIpOCLGabbUABk0hoQl9+oEg4QxVgBTDbDEsHtg6dTyO702Wox9A4mQ0ujpQF7pcp6Bnnm XTytlmlwxEFf/g/7l4Lnc/lhAWZOezxIZzi6wZ1zAiegQaqjkBJEhdJuCaMXCazxPshTgy90l4g o/VxHH4LwUtP+FbbrQwumhK0PSzlsoMuntTMGuYSwzyTl01wXov92aghHeN+QnznTbxXg== X-Google-Smtp-Source: AGHT+IFKW04UUXl5fF4oLYVs/VLuYqAm/7g1dkac5MGSZn8sz7WGg6SSpg/pSzklgGBoF9CvaoD7l+Ql7enT3dWGkIo= X-Received: by 2002:a05:6820:2223:b0:65b:3641:bf7a with SMTP id 006d021491bc7-65d0eb2fcf5mr8344823eaf.81.1766772695569; Fri, 26 Dec 2025 10:11:35 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <7351fc32-93fa-4a22-a311-20c5ec34e01c@bastelstu.be> In-Reply-To: <7351fc32-93fa-4a22-a311-20c5ec34e01c@bastelstu.be> Date: Fri, 26 Dec 2025 19:11:23 +0100 X-Gm-Features: AQt7F2qNZGdd7kyHr3VBLY2KiNZZPupLGUnFSvRmOxPyLSXa0mLBY6TCLVkth6s Message-ID: Subject: Re: [PHP-DEV] [RFC] Polling API To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: PHP internals list Content-Type: multipart/alternative; boundary="000000000000eb18430646ded2d1" From: bukka@php.net (Jakub Zelenka) --000000000000eb18430646ded2d1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Sun, Nov 23, 2025 at 4:05=E2=80=AFPM Tim D=C3=BCsterhus wrote: > Hi > > Apologies for the late reply. It was a few busy weeks leading up to the > PHP 8.5 Release. > > When searching for the RFC text I just noticed that it does not appear > to be listed in https://wiki.php.net/rfc#under_discussion yet. > > This is fixed. > > > > >> As an example PollContext::__construct() should probably throw a > >> BackendUnavailableException or something like this. For > >> PollContext::add() I'm wondering in which cases a handle =E2=80=9Ccann= ot be > >> added=E2=80=9D. > > > > > > It fails if the same fd is added. This is also limitation of backends > (e.g. > > epoll does not allow the same fd to be added twice). I got error code f= or > > the specific errors so this should be probably exposed as well. It woul= d > > still make sense to differentiate that it's an exception for addition. > > I see. I was wondering if it would make sense to simply ignore the > error, thus making the operation idempotent (more convenient for a > high-level language like PHP). But I suppose that doesn't work, because > the `$data` could be different? > > Yeah data and events can be different. > Exception-wise this should probably be a DuplicateHandleError (i.e. > within the Error hierarchy, since it's a programming error to add > duplicate handles). > > I don't think users should be expected to keep track of added handles. So I think that this is something that can be nicely handled and in some cases it will be just fine to just catch it and ignore. So I wouldn't see this as a programmer error and therefore the exception is more appropriate IMHO. I created a specific exception for this called \Io\Poll\HandleAlreadyWatchedException so it will be easy for users to differentiate it. Kind regards, Jakub --000000000000eb18430646ded2d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Sun, Nov 23, 2025 at 4:05= =E2=80=AFPM Tim D=C3=BCsterhus <tim@= bastelstu.be> wrote:
Hi

Apologies for the late reply. It was a few busy weeks leading up to the PHP 8.5 Release.

When searching for the RFC text I just noticed that it does not appear
to be listed in https://wiki.php.net/rfc#under_discussion= yet.


This is fixed.
= =C2=A0

>
>> As an example PollContext::__construct() should probably throw a >> BackendUnavailableException or something like this. For
>> PollContext::add() I'm wondering in which cases a handle =E2= =80=9Ccannot be
>> added=E2=80=9D.
>
>
> It fails if the same fd is added. This is also limitation of backends = (e.g.
> epoll does not allow the same fd to be added twice). I got error code = for
> the specific errors so this should be probably exposed as well. It wou= ld
> still make sense to differentiate that it's an exception for addit= ion.

I see. I was wondering if it would make sense to simply ignore the
error, thus making the operation idempotent (more convenient for a
high-level language like PHP). But I suppose that doesn't work, because=
the `$data` could be different?


Yeah data and events can be different.=
=C2=A0
Exception-wise this should probably be a DuplicateHandleError (i.e.
within the Error hierarchy, since it's a programming error to add
duplicate handles).


I don't think users should be expe= cted to keep track of added handles. So I think that this is something that= can be nicely handled and in some cases it will be just fine to just catch= it and ignore. So I wouldn't see this as a programmer error and theref= ore the exception is more appropriate IMHO. I created a specific exception = for this called \Io\Poll\HandleAlreadyWatchedException so it will be easy f= or users to differentiate it.

Kind regards,
<= div>
Jakub
--000000000000eb18430646ded2d1--