Re: Latch implementation that wakes on postmaster death on both win32 and Unix

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Latch implementation that wakes on postmaster death on both win32 and Unix
Date: 2011-06-16 14:27:26
Message-ID: 4DFA12CE.60305@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Geoghegan wrote:
> --- 247,277 ----
> * do that), and the select() will return immediately.
> */
> drainSelfPipe();
> ! if (latch->is_set && (wakeEvents & WL_LATCH_SET))
> ! {
> ! result |= WL_LATCH_SET;
> ! found = true;
> ! /*
> ! * Leave loop immediately, avoid blocking again.
> ! * Since latch is set, no other factor could have
> ! * coincided that could make us wake up
> ! * independently of the latch being set, so no
> ! * need to worry about having missed something.
> ! */
> break;
> }

I don't understand that comment. Why can't e.g postmaster death happen
at the same time as a latch is set? I think the code is fine as it is,
we just need to document that if there are several events that would
wake up WaitLatch(), we make no promise that we return all of them in
the return value. I believe all the callers would be fine with that.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2011-06-16 14:31:01 Re: procpid?
Previous Message Tom Lane 2011-06-16 14:21:34 Re: Why polecat and colugos are failing to build back branches