Re: thread_test.c problems - Mailing list pgsql-general

From Bruce Momjian
Subject Re: thread_test.c problems
Date
Msg-id 200404050223.i352NO814657@candle.pha.pa.us
Whole thread Raw
In response to Re: thread_test.c problems  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > wespvp@syntegra.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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: thread_test.c problems
Next
From: Tom Lane
Date:
Subject: Re: RPM init-script: Why the locale setting?