Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>, <pgsql-hackers(at)postgresql(dot)org>, "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Subject: Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance
Date: 2005-10-23 20:14:28
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE92E792@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > Here's another version of this patch ;-) I've based it on
> your patch,
> > so the changes to ovalue etc should sitill be there.
>
> In the spirit of incremental improvement ... I've taken
> Magnus' version and added the proposed change to re-enable
> Qingqing's patch by skipping WaitForSingleObjectEx altogether
> in the CHECK_FOR_INTERRUPTS code path.
> I also removed WaitForSingleObjectEx in
> pgwin32_poll_signals(), which AFAICS should be just like
> CHECK_FOR_INTERRUPTS. I think this is what we are proposing
> to actually apply to 8.1beta4. I can't test it though, so
> please check it over...

That does seem right. I think the only reason it was there i nthe first
place was to deliver the APCs.

But. in theory, we can get a false positive from
UNBLOCKED_SIGNAL_QUEUE(), right? Since we do it unlocked between two
threads. If we do that, we'll "recover" in dispatch_signals, because
we'l lcheck again locked and not dispatch any signals. *but*. If this
happens, we will return EINTR even when there is no signal. That doesn't
seem correct to me. It's a very small window, but it should be possible,
no?

We probably need an actual check, so for example have
dispatch_queued_signals return a value indicating if any signals were
actually dispatched, and use that to control EINTR?

Comments? Or am I completely off being too tired right now? ;-)

//Magnus

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Qingqing Zhou 2005-10-23 20:22:26 Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance
Previous Message Tom Lane 2005-10-23 19:55:04 Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance