Clarify wait versus poll behavior in ExecAppendAsyncEventWait

Started by Chao Li19 days ago6 messageshackers
Jump to latest
#1Chao Li
li.evan.chao@gmail.com

Hi,

This is a follow-up to patch [1]/messages/by-id/CAPmGK1648ovA1i_4X+vO=Ci+kSpvvG0H9jcb2m4inybXtSyw6A@mail.gmail.com that I recently reviewed. The header comment of ExecAppendAsyncEventWait can be enhanced, but Etsuro-san considered that a pure improvement, so he asked for a separate patch.

[1]: /messages/by-id/CAPmGK1648ovA1i_4X+vO=Ci+kSpvvG0H9jcb2m4inybXtSyw6A@mail.gmail.com

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t254570_1
v1-0001-Clarify-when-ExecAppendAsyncEventWait-waits-or-po.patchapplication/octet-stream; name=v1-0001-Clarify-when-ExecAppendAsyncEventWait-waits-or-po.patch; x-unix-mode=0644Download+4-1
#2Etsuro Fujita
etsuro.fujita@gmail.com
In reply to: Chao Li (#1)
Re: Clarify wait versus poll behavior in ExecAppendAsyncEventWait

Hi Chao,

On Thu, Nov 5, 2026 at 2:59 PM Chao Li <li.evan.chao@gmail.com> wrote:

This is a follow-up to patch [1] that I recently reviewed. The header comment of ExecAppendAsyncEventWait can be enhanced, but Etsuro-san considered that a pure improvement, so he asked for a separate patch.

Thanks for the patch! Here are my comments:

  *     ExecAppendAsyncEventWait
  *
  *     Wait or poll for file descriptor events and fire callbacks.
+ *
+ *     If node->as_syncdone is true, wait until at least one event
+ *     occurs; otherwise, poll without waiting so synchronous
+ *     execution can proceed.

I don't think this is 100% correct, because even when polling for
events, we will do async execution if some were ready.

BTW: I noticed we are clarifying this by this comment within that function:

/*
* If the timeout is -1, wait until at least one event occurs. If the
* timeout is 0, poll for events, but do not wait at all.
*/

This seems more accurate to me, so how about modifying the latter of
the proposed comments using this, like the attached? This change
makes the above comment redundant, so I removed it and instead added a
brief comment.

Best regards,
Etsuro Fujita

Attachments:

t254570_2
v2-0001-Clarify-when-ExecAppendAsyncEventWait-waits-or-po.patchapplication/octet-stream; name=v2-0001-Clarify-when-ExecAppendAsyncEventWait-waits-or-po.patchDownload+5-4
#3Chao Li
li.evan.chao@gmail.com
In reply to: Etsuro Fujita (#2)
Re: Clarify wait versus poll behavior in ExecAppendAsyncEventWait

On Nov 9, 2026, at 17:15, Etsuro Fujita <etsuro.fujita@gmail.com> wrote:

Hi Chao,

On Thu, Nov 5, 2026 at 2:59 PM Chao Li <li.evan.chao@gmail.com> wrote:

This is a follow-up to patch [1] that I recently reviewed. The header comment of ExecAppendAsyncEventWait can be enhanced, but Etsuro-san considered that a pure improvement, so he asked for a separate patch.

Thanks for the patch! Here are my comments:

*     ExecAppendAsyncEventWait
*
*     Wait or poll for file descriptor events and fire callbacks.
+ *
+ *     If node->as_syncdone is true, wait until at least one event
+ *     occurs; otherwise, poll without waiting so synchronous
+ *     execution can proceed.

I don't think this is 100% correct, because even when polling for
events, we will do async execution if some were ready.

BTW: I noticed we are clarifying this by this comment within that function:

/*
* If the timeout is -1, wait until at least one event occurs. If the
* timeout is 0, poll for events, but do not wait at all.
*/

This seems more accurate to me, so how about modifying the latter of
the proposed comments using this, like the attached? This change
makes the above comment redundant, so I removed it and instead added a
brief comment.

Best regards,
Etsuro Fujita
<v2-0001-Clarify-when-ExecAppendAsyncEventWait-waits-or-po.patch>

Hi Etsuro-san,

Thanks for reviewing and updating the patch. V2 is clearer, and it also eliminates the redundant comment, which is good.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

#4Chao Li
li.evan.chao@gmail.com
In reply to: Etsuro Fujita (#2)
Re: Clarify wait versus poll behavior in ExecAppendAsyncEventWait

On Nov 9, 2026, at 17:15, Etsuro Fujita <etsuro.fujita@gmail.com> wrote:

Hi Chao,

On Thu, Nov 5, 2026 at 2:59 PM Chao Li <li.evan.chao@gmail.com> wrote:

This is a follow-up to patch [1] that I recently reviewed. The header comment of ExecAppendAsyncEventWait can be enhanced, but Etsuro-san considered that a pure improvement, so he asked for a separate patch.

Thanks for the patch! Here are my comments:

*     ExecAppendAsyncEventWait
*
*     Wait or poll for file descriptor events and fire callbacks.
+ *
+ *     If node->as_syncdone is true, wait until at least one event
+ *     occurs; otherwise, poll without waiting so synchronous
+ *     execution can proceed.

I don't think this is 100% correct, because even when polling for
events, we will do async execution if some were ready.

BTW: I noticed we are clarifying this by this comment within that function:

/*
* If the timeout is -1, wait until at least one event occurs. If the
* timeout is 0, poll for events, but do not wait at all.
*/

This seems more accurate to me, so how about modifying the latter of
the proposed comments using this, like the attached? This change
makes the above comment redundant, so I removed it and instead added a
brief comment.

Best regards,
Etsuro Fujita
<v2-0001-Clarify-when-ExecAppendAsyncEventWait-waits-or-po.patch>

Hi Etsuro-san,

Thanks for reviewing and updating the patch. V2 is clearer, and it also eliminates the redundant comment, which is good.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

#5Etsuro Fujita
etsuro.fujita@gmail.com
In reply to: Chao Li (#4)
Re: Clarify wait versus poll behavior in ExecAppendAsyncEventWait

Hi Chao,

On Mon, Nov 9, 2026 at 8:16 PM Chao Li <li.evan.chao@gmail.com> wrote:

V2 is clearer, and it also eliminates the redundant comment, which is good.

Pushed. Thanks for checking!

Best regards,
Etsuro Fujita

#6Chao Li
li.evan.chao@gmail.com
In reply to: Etsuro Fujita (#5)
Re: Clarify wait versus poll behavior in ExecAppendAsyncEventWait

On Nov 10, 2026, at 14:24, Etsuro Fujita <etsuro.fujita@gmail.com> wrote:

Hi Chao,

On Mon, Nov 9, 2026 at 8:16 PM Chao Li <li.evan.chao@gmail.com> wrote:

V2 is clearer, and it also eliminates the redundant comment, which is good.

Pushed. Thanks for checking!

Best regards,
Etsuro Fujita

Hi Etsuro-san,

Thanks for pushing.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/