]> granicus.if.org Git - postgresql/commit
Assert that WaitLatchOrSocket callers cannot wait only for writability.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 May 2012 20:11:59 +0000 (16:11 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 May 2012 20:12:28 +0000 (16:12 -0400)
commite42a21b9e6c9b9e6346a34b62628d48ff2fc6ddf
tree1d4c8483388c1ce744113596d457a4fd4f5cbe35
parentff4628f37a1e700d1fe716d0c271f68d8aa1e4ea
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.
src/backend/port/unix_latch.c
src/backend/port/win32_latch.c