Re: [HACKERS] psql and Control-C - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] psql and Control-C
Date
Msg-id Pine.LNX.4.21.0002191424230.474-100000@localhost.localdomain
Whole thread Raw
In response to Re: [HACKERS] psql and Control-C  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] psql and Control-C
List pgsql-hackers
On 2000-02-18, Tom Lane mentioned:

> > Readline has an official way to preempt is, namely setting rl_done to
> > non-zero. I can take a look how it copes with a longjmp from a signal
> > handler, but I wouldn't set my hopes too high.
> 
> Oh?  Maybe we don't *need* a longjmp: maybe the signal handler just
> needs to do either send-a-cancel or set-rl_done depending on the
> current state of a flag that's set by the main line code.

I tried that but it doesn't work. On further thought I believe that the
purpose of rl_done is for readline extensions, so that, for example, a
semicolon handler can scan the current line and then immediately return as
if you had pressed enter. When idle, readline hangs on read(), so setting
some variable isn't going to interrupt that.

The longjmp seems to work but I need to test it more. I'm concerned how it
will work across platforms, esp. Windows (being a POSIX thing). Should
there be a configure test or can I assume it on every non-WIN32 system?

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Date/time types: big changeu
Next
From: Peter Eisentraut
Date:
Subject: Re: SQL compliance