Re: Interrupts vs signals

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>, Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, Fujii Masao <masao.fujii@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-02-28T20:24:56Z
Lists: pgsql-hackers

Attachments

On 28/01/2025 19:01, Andres Freund wrote:
> On 2024-12-02 16:39:28 +0200, Heikki Linnakangas wrote:
>> This also moves the WaitEventSet functions to a different source file,
>> waiteventset.c. This separates the platform-dependent code waiting and
>> signalling code from the platform-independent parts.
> 
> I think this should be split into a separate commit. It's painful to verify
> that code-movement didn't change anything else if there's lots of other
> changes in the same commit.

Here's a patch set to do just that, split WaitEventSet stuff to a 
separate source file. That's actually a pretty nice separation even 
without any of the rest of the patches.

I noticed that the ShutdownLatchSupport() function is unused. The first 
patch removes it.

The second patch makes it possible to use ModifyWaitEvent() to switch 
between WL_POSTMASTER_DEATH and WL_EXIT_ON_PM_DEATH. WaitLatch() used to 
modify WaitEventSet->exit_on_postmaster_death directly, now it uses 
ModifyWaitEvent() for that. That's needed because with the final patch, 
WaitLatch() is in a different source file than WaitEventSet, so it 
cannot directly modify its field anymore.

The third patch is mechanical and moves existing code. The file header 
comments in the modified files are perhaps worth reviewing. They are 
also just existing text moved around, but there was some small decisions 
on what exactly should go where.

I'll continue working on the other parts, but these patches seems ready 
for commit already.

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

Commits

  1. Ignore SIGINT in walwriter and walsummarizer

  2. Split WaitEventSet functions to separate source file

  3. Use ModifyWaitEvent to update exit_on_postmaster_death

  4. Remove unused ShutdownLatchSupport() function

  5. Rename two functions that wake up other processes

  6. Use ProcNumbers instead of direct Latch pointers to address other procs

  7. Clean up WaitLatch calls that passed latch without WL_LATCH_SET

  8. Remove unneeded #include

  9. Remove unused latch

  10. Remove support for background workers without BGWORKER_SHMEM_ACCESS.