Re: thread_test.c problems

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: wespvp(at)syntegra(dot)com
Cc: 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-04 17:27:44
Message-ID: 200404041727.i34HRif23417@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

wespvp(at)syntegra(dot)com wrote:
> On 4/4/04 12:33 AM, "joseph speigle" <joe(dot)speigle(at)jklh(dot)us> wrote:
>
> > have you tried adding a volatile keyword to the
> >
> > int volatile errno1_set = 0;
> > int volatile errno2_set = 0;
> >
> > that should stop while-loop optimizing for cases where the variable is
> > modified in a scope the compiler would be ignorant of, and precludes compiler
> > while-loop optimization. That would then tell you if it was a while loop
> > optimization problem.
>
> That cures the problem on all systems. What needs to be done to get this
> updated in the tip?
>
> > As for me on RH 8.0
> >
> > gcc -v
> > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
> > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> > --infodir=/usr/share/info --enable-shared --enable-threads=posix
> > --disable-checking --host=i386-redhat-linux --with-system-zlib
> > --enable-__cxa_atexit
> > Thread model: posix
> > gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
> >
> > sorry, they all run yes/no/no
>
> I don't know what is different, but I've tried it on RH 7.2, RH AS 3.0, and
> Mac OS X. All hang in an infinite loop with the tip version of
> thread_test.c, and all work if I add 'volatile' to the definitions of
> errno1_set and errno2_set.
>
> There's still the question of which version of the program is giving the
> right answers - the 7.4.2 version or the tip version?

I have applied the following patch to CVS head which does a getpid() in
the loop, rather than nothing. getpid() should force a system call,
which will make it more likely for the other thread to get CPU time and
complete its tests.

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

Attachment Content-Type Size
unknown_filename text/plain 2.4 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Erickson 2004-04-04 19:40:27 Re: Creating a trigger function
Previous Message Konstantinos Agouros 2004-04-04 15:28:20 Invalid page header in block...

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2004-04-04 18:15:54 serial vs parallell regression tests
Previous Message Magnus Hagander 2004-04-04 12:19:21 Re: Function to kill backend