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