Re: Strange Windows problem, lock_timeout test request

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Hari Babu <haribabu(dot)kommi(at)huawei(dot)com>, 'Craig Ringer' <craig(at)2ndQuadrant(dot)com>, 'Hans-Jürgen Schönig' <hs(at)cybertec(dot)at>, 'Ants Aasma' <ants(at)cybertec(dot)at>, 'PostgreSQL Hackers' <pgsql-hackers(at)postgresql(dot)org>, 'Amit kapila' <amit(dot)kapila(at)huawei(dot)com>
Subject: Re: Strange Windows problem, lock_timeout test request
Date: 2013-03-18 05:22:42
Message-ID: 5146A4A2.9090801@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013-03-18 03:52 keltezéssel, Tom Lane írta:
> Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
>> 2013-03-17 16:07 keltezéssel, Tom Lane írta:
>>> It suddenly occurs to me though that there's more than one way to skin
>>> this cat. We could easily add another static flag variable called
>>> "sigalrm_allowed" or some such, and have the signal handler test that
>>> and immediately return without doing anything if it's off. Clearing
>>> and setting such a variable would be a lot cheaper than an extra
>>> setitimer call, as well as more robust since it would protect us from
>>> all sources of SIGALRM not just ITIMER_REAL.
>> Something like the attached patch?
> Well, something like that, but it still needed some improvements. In
> particular I thought it best to leave the signal handler still releasing
> the procLatch unconditionally --- that behavior is independent of what
> this module is doing. Also you seem to have some odd ideas about what
> do-while will accomplish. AFAIK, in this usage it's purely a syntactic
> trick without much semantic content. It's the marking of the variable
> as "volatile" that counts for telling the compiler not to re-order
> operations.

The volatile marking shouldn't even be necessary there.
The signal handler doesn't writes to it, only the main code.
I just put it there saying "why not?" to myself.
IIRC, volatile is needed if both the signal handler and the
main code changes the same variable.

I got the reordering idea from here:
http://yarchive.net/comp/linux/compiler_barriers.html

Thanks for committing,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2013-03-18 05:26:08 Re: Enabling Checksums
Previous Message Craig Ringer 2013-03-18 05:07:15 Re: Trust intermediate CA for client certificates