Re: Can we get rid of TerminateThread() in pg_dump?

Jelte Fennema-Nio <postgres@jeltef.nl>

From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Bryan Green <dbryan.green@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers <pgsql-hackers@postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: 2026-07-06T12:18:20Z
Lists: pgsql-hackers
On Sun, 5 Jul 2026 at 07:03, Thomas Munro <thomas.munro@gmail.com> wrote:
> I didn't even look into that, because I was deliberately trying to
> avoid needing atomics from here, because I need this to work on Unix
> too, and I didn't want to open too many cans of worms at the same
> time.

We do have cross-platform locks on the frontend, so we could use those
for now if needed. I don't think this needs atomic for performance
reasons and once we have atomics on the frontend it should be easy to
swap out the a lock for an atomic operation.

> 1. If we're ready to drop VS < 2022 and GCC < 4.9, we could just use
> <stdatomic.h> directly in frontend code (independently of the project
> to use it in the backend).

I think we are ready, see this thread[1].

We'd still need a MacOS version of stdatomic.h though before we could
rely on it.

[1]: https://www.postgresql.org/message-id/2a965ac6-fa42-4054-bee0-b1618e7729d6@eisentraut.org



Commits

  1. Redesign handling of SIGTERM/control-C in parallel pg_dump/pg_restore.