pgsql: Assert that WaitLatchOrSocket callers cannot wait only for writa

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Assert that WaitLatchOrSocket callers cannot wait only for writa
Date: 2012-05-14 20:12:47
Message-ID: E1SU1dP-0007Zq-Ca@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e42a21b9e6c9b9e6346a34b62628d48ff2fc6ddf

Modified Files
--------------
src/backend/port/unix_latch.c | 10 ++++++++--
src/backend/port/win32_latch.c | 2 ++
2 files changed, 10 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2012-05-14 23:31:20 Re: Re: [COMMITTERS] pgsql: Ensure age() returns a stable value rather than the latest value
Previous Message Peter Eisentraut 2012-05-14 20:04:53 pgsql: Remove unused AC_DEFINE symbols