Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Elena Zannoni <ezannoni@redhat.com>
To: Michael Elizabeth Chastain <mec@shout.net>
Cc: ezannoni@redhat.com, gdb@sources.redhat.com
Subject: Re: Bug in testsuite/gdb.base/tls.c
Date: Tue, 29 Jul 2003 20:56:00 -0000	[thread overview]
Message-ID: <16166.57656.743881.52826@localhost.redhat.com> (raw)
In-Reply-To: <200307292007.h6TK79up016297@duracef.shout.net>

Michael Elizabeth Chastain writes:
 > I'm seeing a lot of test suite hangs with the new tls.c.
 > I tracked it down to this code:
 > 
 >   for( i = 0; i < N_THREADS; i++ )
 >     {
 >       do
 > 	{
 > 	  errno = 0;
 > 
 > 	  if (sem_wait (&tell_main) == -1)
 > 	    {
 > 	      if (errno != EINTR)
 > 		{
 > 		  ...
 > 		  return;
 > 		}
 > 	      ...
 > 	    }
 > 	  }
 > 	  while (errno == EINTR);
 >     }
 > 
 > It turns out that errno can be EINTR even when the return value is 0!
 > That screws up the loop counter.

Whoops, never seen this one happening on my systems, just (bad) luck I guess.

 > 
 > This happened with Red Hat Linux 8, glibc 2.2.93-5-rh.  It is sensitive
 > to the placement of breakpoints, which is not surprising.
 > 
 > I think it's normal Unix semantics that when the return value is zero,
 > errno has no meaning.

Yes, true. 

"All semaphore functions introduced by POSIX.1b use the old error
reporting mechanism. These functions return 0 on success and -1 on
error, with errno set to the appropriate error"

Note how it carefully avoids mentioning what happens to errno in case
of success.

 > 
 > I'll code up a patch for tls.c, on those lines.
 > 

thanks
elena


 > Michael C


      reply	other threads:[~2003-07-29 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 20:07 Michael Elizabeth Chastain
2003-07-29 20:56 ` Elena Zannoni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16166.57656.743881.52826@localhost.redhat.com \
    --to=ezannoni@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=mec@shout.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox