Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.) - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)
Date
Msg-id 54D12CD2.2060100@vmware.com
Whole thread Raw
In response to Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)
List pgsql-hackers
On 02/03/2015 08:54 PM, Andres Freund wrote:
> * Previously the patchset didn't handle SIGTERM while
>    InteractiveBackend() was reading from the client. It did handle
>    ctrl-c/d, but since getc() isn't interruptible and can't be replaced
>    with latches... The fix for that isn't super pretty:
>    die():
>        if (DoingCommandRead && whereToSendOutput != DestRemote)
>         ProcessInterrupts();
>    but imo acceptable for single user mode.

That smells an awful lot like ImmediateInterruptOK. Could you use 
WaitLatchOrSocket to sleep on stdin? Probably needs to be renamed or 
copied to WaitLatchOrStdin(), or a new flag to be added to wait on stdin 
instead of a socket, at least on Windows, but in theory.

Might not be worth it if it gets complicated - I can live with the above 
- but it's a thought.

- Heikki




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)
Next
From: Andres Freund
Date:
Subject: Re: Re: Overhauling our interrupt handling (was Escaping from blocked send() reprised.)