WIN32 psql Ctrl+C support

Started by Ludek Finstrleover 22 years ago4 messagespatches
Jump to latest
#1Ludek Finstrle
luf@pzkagis.cz

Hello,

I write Ctrl+C support for Win32 psql client. I create diff
againist CVS snapshoted today.

Comments are welcome

Luf

Attachments:

psql-win32-ctrlc.difftext/plain; charset=us-asciiDownload+53-21
#2Magnus Hagander
magnus@hagander.net
In reply to: Ludek Finstrle (#1)
Re: WIN32 psql Ctrl+C support

You need to make all variable access (including libpq, I think) in the
handler threadsafe. The control handler will execute on a different
thread from the main one (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc
/base/handlerroutine.asp).

One way to do this could be to have the handler just set an event or a
variable, and then poll this one in the main thread. For more
information about these issues, see recent threads on signal handling on
pgsql-hackers-win32 (which deals with the server, but much the same
issues).

//Magnus

Show quoted text

-----Original Message-----
From: Ludek Finstrle [mailto:luf@pzkagis.cz]
Sent: Wednesday, January 14, 2004 1:03 PM
To: pgsql-patches@postgresql.org
Subject: [PATCHES] WIN32 psql Ctrl+C support

Hello,

I write Ctrl+C support for Win32 psql client. I create diff
againist CVS snapshoted today.

Comments are welcome

Luf

#3Bruce Momjian
bruce@momjian.us
In reply to: Magnus Hagander (#2)
Re: WIN32 psql Ctrl+C support

Where are we on this patch?

---------------------------------------------------------------------------

Magnus Hagander wrote:

You need to make all variable access (including libpq, I think) in the
handler threadsafe. The control handler will execute on a different
thread from the main one (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc
/base/handlerroutine.asp).

One way to do this could be to have the handler just set an event or a
variable, and then poll this one in the main thread. For more
information about these issues, see recent threads on signal handling on
pgsql-hackers-win32 (which deals with the server, but much the same
issues).

//Magnus

-----Original Message-----
From: Ludek Finstrle [mailto:luf@pzkagis.cz]
Sent: Wednesday, January 14, 2004 1:03 PM
To: pgsql-patches@postgresql.org
Subject: [PATCHES] WIN32 psql Ctrl+C support

Hello,

I write Ctrl+C support for Win32 psql client. I create diff
againist CVS snapshoted today.

Comments are welcome

Luf

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Ludek Finstrle
luf@pzkagis.cz
In reply to: Bruce Momjian (#3)
Re: WIN32 psql Ctrl+C support

Where are we on this patch?

I don't have enough time to fully understand the problem which Magnus notice.
The patch I sent I use on 5 computers with no problem. It's sufficient
solution for me now.

Luf

Show quoted text

You need to make all variable access (including libpq, I think) in the
handler threadsafe. The control handler will execute on a different
thread from the main one (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc
/base/handlerroutine.asp).

One way to do this could be to have the handler just set an event or a
variable, and then poll this one in the main thread. For more
information about these issues, see recent threads on signal handling on
pgsql-hackers-win32 (which deals with the server, but much the same
issues).

//Magnus

I write Ctrl+C support for Win32 psql client. I create diff
againist CVS snapshoted today.