Skip site navigation (1) Skip section navigation (2)

Re: signals on windows

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "pgsql-hackers-win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: signals on windows
Date: 2003-10-10 11:28:51
Message-ID: 000f01c38f21$aeebfd60$6401a8c0@DUNSLANE (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers-win32
Thanks. I think for now the most portable and simple thing we can do in
initdb is simply to have the signal handler set a flag that is checked for
every so often. That's what my current code does. See

If you think this won't work on Windows please let me know - I'm quite
confident it will work elsewhere.



----- Original Message ----- 
From: "Marsh Ray" <marsh-pg(at)mysteray(dot)com>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Andrew Dunstan" <andrew(at)dunslane(dot)net>; "pgsql-hackers-win32"
Sent: Friday, October 10, 2003 12:09 AM
Subject: Re: [pgsql-hackers-win32] signals on windows

> Hi,
> This MS documentation looks like it's slightly retro. I've been trying
> to decypher this stuff myself for a decade, so I might offer some points:.
> >Andrew Dunstan wrote:
> >
> >
> >> *   Note   SIGINT is not supported for any Win32 application, including
> >>*   Windows 98/Me and Windows NT/2000/XP.When a CTRL+C interrupt occurs,
> >> *   Win32 operating systems generate a new thread to specifically
> >> *   that interrupt. This can cause a single-thread application such as
> >>UNIX,
> >> *   to become multithreaded, resulting in unexpected behavior.
> >>
> Odd. First they say it's not supported, then they go on to define how it
> works. Probably what they mean is that Win32 _GUI_ applications have no
> way to have receive SIGINT from Ctrl+C, because that's handled as just
> another keystroke by the GUI system (sometimes you'll see the older
> documentation use Win32 as a term implying GUI).  Win32 console apps
> appear to respond to Ctrl+C much like unices do.
> Since Win32 will create a new thread for you, if you prepare your app
> for that, I don't see a reason you can't make pure Win32 system calls
> from that thread. You mainly want to be careful to not confuse a
> single-threaded C runtime. Note that the doc
> says not to "use any function that generates a system call (e.g.,
> *_getcwd*, *time*)", it doesn't say not to make system calls themselves.
> It doesn't look like a "signal" is not a kernel primitive on NT, it's a
> feature of the CRT implemented in userspace with lower-level OS
> >> * I have no idea how to handle this. (Strange they call UNIX an
> >>application!)
> >> * So this will need some testing on Windows.
> >> * One alternative might be to set a flag that we periodically check
> >>
> A kernel Event
> is a common tool for this sort of thing.
> - Marsh

In response to

pgsql-hackers-win32 by date

Next:From: Andrew DunstanDate: 2003-10-10 11:50:06
Subject: Re: [HACKERS] initdb
Previous:From: Marsh RayDate: 2003-10-10 04:09:40
Subject: Re: signals on windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group