Re: HEADS UP: Win32/OS2/BeOS native ports - Mailing list pgsql-hackers

From Matthew Kirkwood
Subject Re: HEADS UP: Win32/OS2/BeOS native ports
Date
Msg-id Pine.LNX.4.33.0205071204590.4713-100000@sphinx.mythic-beasts.com
Whole thread Raw
In response to Re: HEADS UP: Win32/OS2/BeOS native ports  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: HEADS UP: Win32/OS2/BeOS native ports  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 6 May 2002, Tom Lane wrote:

> > As a backend is started up, connect to that socket ... if socket is open
> > when trying to start a new frontend, fail as there are currently other
> > connections attached to it?
>
> But the backends would only have the socket open, they'd not be
> actively listening to it.  So how could you tell whether anyone
> had the socket open or not?

It's easy.  As startup, the postmaster (or standalone
backend) creates a Unix socket, binds it to the filename
and calls listen on it.

If another backend is running, it'll get EADDRINUSE from
the bind or listen.

Nobody actually needs to connect to the socket.  Simple,
race-free, 10 lines of code.

Matthew.



pgsql-hackers by date:

Previous
From: "Nigel J. Andrews"
Date:
Subject: Re: Schemas: status report, call for developers
Next
From:
Date:
Subject: Re: STILL LACKING: CVS tag for release 7.2.1