Re: [HACKERS] [PATCHES] fork/exec patch
- From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
- To: Magnus Hagander <mha(at)sollentuna(dot)net>
- Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org>
- Subject: Re: [HACKERS] [PATCHES] fork/exec patch
- Date: Tue, 16 Dec 2003 20:29:23 -0500 (EST)
- Message-id: <200312170129(dot)hBH1TN827382(at)candle(dot)pha(dot)pa(dot)us>
Having read through this massive thread, I concluded the CONNX signal
stuff is the way to go. Where there any Win32 TODO items in there? I
didn't see any.
---------------------------------------------------------------------------
Magnus Hagander wrote:
> >>>Isn't WaitForSingleObject() in effect a polling call?
> >>>
> >>>
> >>It puts your thread to sleep, until it gets woken up by the handle
> >>you're waiting on being set to a signalled state.
> >>
> >>
> >>
> >
> >Right. Just like select() puts your thread to sleep until one of its
> >files is ready (or it times out).
> >
> >Do we have a terminology problem here?
> >
> >The point is that, unlike classic Unix signal programming, you need
> >*something* that explicitly checks for the event. It could be
> >a separate
> >thread in a tight loop, which is what the CONNX code appears to do, or
> >it could conceivably be something else in the main thread with a very
> >short timeout.
>
> Yes, if you include the wait...() in the tight loop, which means it will
> spend 99.999% of it's time in sleeping state (kernel blocked). But yes,
> in some way it has to go back into the main thread. Either through some
> kind of polling or through exception. Unless the handlers are
> threadsafe.
>
>
> I know at least the SIGHUP handler in pgsql (backend/tcop/postgres.c)
> just sets a flag in the signal handler, which could be easily protected
> (this flag is polled in the main loop). The comments seem to indicate
> the idea that complex signal handlers = bad. I guess we need to check
> out the other signal handlers - if they're that easy, then it's a
> non-point and they can really easy be made thread-safe.
>
> //Magnus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Home |
Main Index |
Thread Index