Re: thread_test.c problems

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: wespvp(at)syntegra(dot)com, joseph speigle <joe(dot)speigle(at)jklh(dot)us>, PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: thread_test.c problems
Date: 2004-04-05 02:23:24
Message-ID: 200404050223.i352NO814657@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > wespvp(at)syntegra(dot)com wrote:
> > have you tried adding a volatile keyword to the
> > int volatile errno1_set = 0;
> > int volatile errno2_set = 0;
> >
> > I have applied the following patch to CVS head which does a getpid() in
> > the loop, rather than nothing.
>
> That does not cure the bug identified by wespvp. It may make it a
> little less likely that the compiler will choose to optimize out the
> loop test, but only adding "volatile" really fixes the problem in
> a language-standard-compliant way.

Thanks, 'volatile' added to the thread-specific errno variables:

volatile int errno1_set = 0;
volatile int errno2_set = 0;

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-04-05 02:50:11 Re: RPM init-script: Why the locale setting?
Previous Message Tom Lane 2004-04-05 02:21:25 Re: thread_test.c problems

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-04-05 02:23:46 Re: Function to kill backend
Previous Message Tom Lane 2004-04-05 02:21:25 Re: thread_test.c problems