mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Provide sigaction() for Windows.
Commit9abb2bfcleft behind code to block signals inside signal handlers on Windows, because our signal porting layer didn't have sigaction(). Provide a minimal implementation that is capable of blocking signals, to get rid of platform differences. See also related commitc94ae9d8. Discussion: https://postgr.es/m/CA%2BhUKGKKKfcgx6jzok9AYenp2TNti_tfs8FMoJpL8%2B0Gsy%3D%3D_A%40mail.gmail.com
This commit is contained in:
@@ -110,16 +110,10 @@ pqinitmask(void)
|
||||
* postmaster ever unblocks signals.
|
||||
*
|
||||
* pqinitmask() must have been invoked previously.
|
||||
*
|
||||
* On Windows, this function is just an alias for pqsignal()
|
||||
* (and note that it's calling the code in src/backend/port/win32/signal.c,
|
||||
* not src/port/pqsignal.c). On that platform, the postmaster's signal
|
||||
* handlers still have to block signals for themselves.
|
||||
*/
|
||||
pqsigfunc
|
||||
pqsignal_pm(int signo, pqsigfunc func)
|
||||
{
|
||||
#ifndef WIN32
|
||||
struct sigaction act,
|
||||
oact;
|
||||
|
||||
@@ -142,7 +136,4 @@ pqsignal_pm(int signo, pqsigfunc func)
|
||||
if (sigaction(signo, &act, &oact) < 0)
|
||||
return SIG_ERR;
|
||||
return oact.sa_handler;
|
||||
#else /* WIN32 */
|
||||
return pqsignal(signo, func);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user