You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assert that WaitLatchOrSocket callers cannot wait only for writability.
Since we have chosen to report socket EOF and error conditions via the
WL_SOCKET_READABLE flag bit, it's unsafe to wait only for
WL_SOCKET_WRITEABLE; the caller would never be notified of the socket
condition, and in some of these implementations WaitLatchOrSocket would
busy-wait until something else happens. Add this restriction to the API
specification, and add Asserts to check that callers don't try to do that.
At some point we might want to consider adjusting the API to relax this
restriction, but until we have an actual use case for waiting on a
write-only socket, it seems premature to design a solution.
Copy file name to clipboard<
10000
span class="prc-TooltipV2-Tooltip-cYMVY" data-direction="s" role="tooltip" aria-hidden="true" id=":Rhmtlab:">Expand all lines: src/backend/port/unix_latch.c
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -172,6 +172,10 @@ WaitLatch(volatile Latch *latch, int wakeEvents, long timeout)
172
172
/*
173
173
* Like WaitLatch, but with an extra socket argument for WL_SOCKET_*
174
174
* conditions.
175
+
*
176
+
* When waiting on a socket, WL_SOCKET_READABLE *must* be included in
177
+
* 'wakeEvents'; WL_SOCKET_WRITEABLE is optional. The reason for this is
178
+
* that EOF and error conditions are reported only via WL_SOCKET_READABLE.
0 commit comments