mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Assert that pgwin32_signal_initialize() has been called early enough.
Before the pgwin32_signal_initialize() call, the backend version of
pg_usleep() has no effect. No in-tree code falls afoul of that today,
but temporary commit 23078689a9
did so.
Discussion: https://postgr.es/m/20190402135442.GA1173872@rfd.leadboat.com
This commit is contained in:
@ -52,6 +52,7 @@ static BOOL WINAPI pg_console_handler(DWORD dwCtrlType);
|
||||
void
|
||||
pg_usleep(long microsec)
|
||||
{
|
||||
Assert(pgwin32_signal_event != NULL);
|
||||
if (WaitForSingleObject(pgwin32_signal_event,
|
||||
(microsec < 500 ? 1 : (microsec + 500) / 1000))
|
||||
== WAIT_OBJECT_0)
|
||||
@ -108,6 +109,7 @@ pgwin32_dispatch_queued_signals(void)
|
||||
{
|
||||
int exec_mask;
|
||||
|
||||
Assert(pgwin32_signal_event != NULL);
|
||||
EnterCriticalSection(&pg_signal_crit_sec);
|
||||
while ((exec_mask = UNBLOCKED_SIGNAL_QUEUE()) != 0)
|
||||
{
|
||||
@ -209,6 +211,7 @@ pgwin32_create_signal_listener(pid_t pid)
|
||||
void
|
||||
pg_queue_signal(int signum)
|
||||
{
|
||||
Assert(pgwin32_signal_event != NULL);
|
||||
if (signum >= PG_SIGNAL_COUNT || signum <= 0)
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user