Re: [HACKERS] [PATCHES] fork/exec patch

Lists: pgsql-hackers-win32
From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "pgsql-hackers-win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCHES] fork/exec patch
Date: 2003-12-17 10:03:08
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE2A6948@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

> 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.

Well. There is one in the form of "make signal handlers thread-safe or
defer non-threadsafe handlers".
But before we're committed down that path, I think we need someone with
really good knowledge in those signal handlers to comment on wether this
sounsd reasonable at all, or if it iwll be too much work. I know I don't
have that knowledge, and from what I read we've had nobody speak up yet.

Basically, we want signal handlers to run on a separate thread from the
main processing.

//Magnus


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "pgsql-hackers-win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCHES] fork/exec patch
Date: 2003-12-17 14:56:49
Message-ID: 27837.1071673009@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> Well. There is one in the form of "make signal handlers thread-safe or
> defer non-threadsafe handlers".

As long as there is only one thread that can invoke signal handlers,
I don't see why you think they need to be "thread-safe".

It's already the case that we either handle execution of a signal
handler everywhere, or block delivery of the signal where we can't
handle it, because in the Unix model a signal handler can execute
anytime.

I'd be more concerned about whether the proposed implementation accurately
models signal mask processing (ie, temporary blocking of signal delivery).

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCHES] fork/exec patch
Date: 2003-12-17 15:30:11
Message-ID: 200312171530.hBHFUBh05241@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

Tom Lane wrote:
> "Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> > Well. There is one in the form of "make signal handlers thread-safe or
> > defer non-threadsafe handlers".
>
> As long as there is only one thread that can invoke signal handlers,
> I don't see why you think they need to be "thread-safe".
>
> It's already the case that we either handle execution of a signal
> handler everywhere, or block delivery of the signal where we can't
> handle it, because in the Unix model a signal handler can execute
> anytime.
>
> I'd be more concerned about whether the proposed implementation accurately
> models signal mask processing (ie, temporary blocking of signal delivery).

On the Win32 project page:

http://momjian.postgresql.org/main/writings/pgsql/project/win32.html

I see for the CONNX driver code that handles signal masking:

/*
The sigsetmask system call replaces the set of blocked
signals totally with a new set specified in mask. Signals
are blocked if the corresponding bit in mask is a 1.
*/

int sigsetmask(int nNewMask)
{
int nPreviousMask = nGlobalSignalMask;
nGlobalSignalMask = nNewMask;
return nPreviousMask;
}

int sigmask(int nSignal)
{
return 1 << ((nSignal) - 1);
}

CONNX_signal_function CONNX_signal(int sig, CONNX_signal_function func)
{
CONNX_signal_function oldfunc;
oldfunc = CONNX_signal_array[sig];
CONNX_signal_array[sig] = func;
return oldfunc;
}

--
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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCHES] fork/exec patch
Date: 2003-12-17 15:35:52
Message-ID: 28144.1071675352@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 캔SQL : Postg토토

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> I see for the CONNX driver code that handles signal masking:

Aren't these functions in themselves totally thread-unsafe?

That wouldn't matter in a non-thread-based implementation, but if you
are going to rely on a second thread to handle signal processing, all
of the code that manipulates the private state of the signal emulation
had better be thread-safe.

regards, tom lane