Improving the comments in pqsignal()

Started by Thomas Munroabout 3 years ago3 messageshackers
Jump to latest
#1Thomas Munro
thomas.munro@gmail.com

Hi,

While following along with Tristan and Heikki's thread about signals
in psql, it occurred to me that the documentation atop pqsignal() is
not very good:

* we don't explain what problem it originally solved
* we don't explain why it's still needed today
* we don't explain what else it does for us today
* we describe the backend implementation for Windows incorrectly (mea culpa)
* we vaguely mention one issue with Windows frontend code, but I
think the point made is misleading, and we don't convey the scale of
the differences

Here is my attempt to improve it.

Attachments:

0001-Improve-comments-about-pqsignal.patchtext/x-patch; charset=US-ASCII; name=0001-Improve-comments-about-pqsignal.patchDownload+23-9
#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Thomas Munro (#1)
Re: Improving the comments in pqsignal()

On 24/11/2023 00:33, Thomas Munro wrote:

Hi,

While following along with Tristan and Heikki's thread about signals
in psql, it occurred to me that the documentation atop pqsignal() is
not very good:

* we don't explain what problem it originally solved
* we don't explain why it's still needed today
* we don't explain what else it does for us today
* we describe the backend implementation for Windows incorrectly (mea culpa)
* we vaguely mention one issue with Windows frontend code, but I
think the point made is misleading, and we don't convey the scale of
the differences

Here is my attempt to improve it.

Thanks!

This is program 10.12 from Advanced Programming in the UNIX
Environment, with minor changes.

In the copy I found online (3rd edition), it's "Figure 10.18", not
"program 10.12".

Other than that, looks good.

--
Heikki Linnakangas
Neon (https://neon.tech)

#3Thomas Munro
thomas.munro@gmail.com
In reply to: Heikki Linnakangas (#2)
Re: Improving the comments in pqsignal()

On Fri, Nov 24, 2023 at 8:55 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On 24/11/2023 00:33, Thomas Munro wrote:

This is program 10.12 from Advanced Programming in the UNIX
Environment, with minor changes.

In the copy I found online (3rd edition), it's "Figure 10.18", not
"program 10.12".

Other than that, looks good.

Thanks. I removed that number (it's easy enough to find), replaced
"underdocumented" with "unspecified" (a word from the later edition of
Stevens) and added a line break to break up that final paragraph, and
pushed. Time to upgrade my treeware copy of that book...

One thing I worried about while writing that text: why is it OK that
win32_port.h redefines SIG_DFL etc, if they might be exposed to the
system signal()? But it seems we picked the same numerical values. A
little weird, but not going to break anything.