postgresql/src/backend/port
Tom Lane 16114f2ea0 Use only one thread to handle incoming signals on Windows.
Since its inception, our Windows signal emulation code has worked by
running a main signal thread that just watches for incoming signal
requests, and then spawns a new thread to handle each such request.
That design is meant for servers in which requests can take substantial
effort to process, and it's worth parallelizing the handling of
requests.  But those assumptions are just bogus for our signal code.
It's not much more than pg_queue_signal(), which is cheap and can't
parallelize at all, plus we don't really expect lots of signals to
arrive at the same backend at once.  More importantly, this approach
creates failure modes that we could do without: either inability to
spawn a new thread or inability to create a new pipe handle will risk
loss of signals.  Hence, dispense with the separate per-signal threads
and just service each request in-line in the main signal thread.  This
should be a bit faster (for the normal case of one signal at a time)
as well as more robust.

Patch by me; thanks to Andrew Dunstan for testing and Amit Kapila
for review.

Discussion: https://postgr.es/m/4412.1575748586@sss.pgh.pa.us
2019-12-11 15:09:54 -05:00
..
aix
hpux
tas Update copyright for 2019 2019-01-02 12:44:25 -05:00
win32 Use only one thread to handle incoming signals on Windows. 2019-12-11 15:09:54 -05:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
atomics.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
posix_sema.c Use data directory inode number, not port, to select SysV resource keys. 2019-09-05 13:31:46 -04:00
sysv_sema.c Use data directory inode number, not port, to select SysV resource keys. 2019-09-05 13:31:46 -04:00
sysv_shmem.c Use data directory inode number, not port, to select SysV resource keys. 2019-09-05 13:31:46 -04:00
win32_sema.c Use data directory inode number, not port, to select SysV resource keys. 2019-09-05 13:31:46 -04:00
win32_shmem.c Use data directory inode number, not port, to select SysV resource keys. 2019-09-05 13:31:46 -04:00