pgsql: Teach WaitEventSetWait() to report multiple events on Windows. - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Teach WaitEventSetWait() to report multiple events on Windows.
Date
Msg-id E1qeVL3-002uxz-Vn@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Teach WaitEventSetWait() to report multiple events on Windows.

The WAIT_USE_WIN32 implementation of WaitEventSetWait() previously
reported at most one event per call, because that's what the underlying
WaitForMultipleObjects() call does.

We can make the behavior match the three Unix implementations by looping
until our output buffer is full, or there are no more events available
now.  This makes no difference to most callers including the regular
FEBE socket code, since they ask for at most one event anyway.  A
difference in socket accept priority might be perceived by end users
after commit 7389aad6 started using WaitEventSet in the postmaster.
With this commit, the accept order now matches Unix systems, servicing
listening sockets in round-robin order.

We decided it wasn't really a bug or worth back-patching, but it seems
good to align the behavior across platforms.

Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Tested-by: "Wei Wang (Fujitsu)" <wangw.fnst@fujitsu.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2BA2dk29hr5zRP3HVJQ-_PncNJM6HVQ7aaYLXLRBZU-xw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/04a09ee944ac904c7fb7ca8f7230a524f514b3e7

Modified Files
--------------
src/backend/storage/ipc/latch.c | 228 +++++++++++++++++++++++-----------------
1 file changed, 132 insertions(+), 96 deletions(-)


pgsql-committers by date:

Previous
From: Thomas Munro
Date:
Subject: pgsql: Remove some more "snapshot too old" vestiges.
Next
From: Daniel Gustafsson
Date:
Subject: pgsql: doc: Extend documentation of PG_TEST_EXTRA