aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Chastain <mec@google.com>2003-07-29 21:51:25 +0000
committerMichael Chastain <mec@google.com>2003-07-29 21:51:25 +0000
commit51514e061b222877bfd594484905ab3693c837e8 (patch)
treeffc9489a3a6cc79b169b73fdf6815cb92cd410ec /gdb/testsuite/gdb.threads
parent2003-07-22 Michael Snyder <msnyder@redhat.com> (diff)
downloadbinutils-gdb-51514e061b222877bfd594484905ab3693c837e8.tar.gz
binutils-gdb-51514e061b222877bfd594484905ab3693c837e8.tar.bz2
binutils-gdb-51514e061b222877bfd594484905ab3693c837e8.zip
2003-07-29 Michael Chastain <mec@shout.net>
* gdb.threads/tls.c (spin): Check errno only if sem_wait actually failed. (do_pass): Likewise. * gdb.threads/tls.exp: Always initialize no_of_threads.
Diffstat (limited to 'gdb/testsuite/gdb.threads')
-rw-r--r--gdb/testsuite/gdb.threads/tls.c67
-rw-r--r--gdb/testsuite/gdb.threads/tls.exp1
2 files changed, 34 insertions, 34 deletions
diff --git a/gdb/testsuite/gdb.threads/tls.c b/gdb/testsuite/gdb.threads/tls.c
index c4f6a30432c..9b2145e652f 100644
--- a/gdb/testsuite/gdb.threads/tls.c
+++ b/gdb/testsuite/gdb.threads/tls.c
@@ -89,26 +89,28 @@ void *spin( vp )
fprintf (stderr, "th %d post on tell main\n", me);
#endif
- do
+ while (1)
{
- errno = 0;
#ifdef START_DEBUG
fprintf (stderr, "th %d start wait on tell_thread\n", me);
#endif
- if (sem_wait (&tell_thread) == -1)
- {
- if (errno != EINTR)
- {
- fprintf (stderr, "th %d wait on sem tell_thread failed\n", me);
- print_error ();
- return;
- }
+ if (sem_wait (&tell_thread) == 0)
+ break;
+
+ if (errno == EINTR)
+ {
#ifdef START_DEBUG
- fprintf (stderr, "th %d wait tell_thread got EINTR, rewaiting\n", me);
+ fprintf (stderr, "th %d wait tell_thread got EINTR, rewaiting\n", me);
#endif
+ continue;
+ }
+ else
+ {
+ fprintf (stderr, "th %d wait on sem tell_thread failed\n", me);
+ print_error ();
+ return;
}
}
- while (errno == EINTR);
#ifdef START_DEBUG
fprintf (stderr, "th %d Wait on tell_thread\n", me);
@@ -151,33 +153,30 @@ do_pass()
}
for( i = 0; i < N_THREADS; i++ )
- {
- do
- {
- errno = 0;
-
-#ifdef START_DEBUG
- fprintf (stderr, "main %d start wait on tell_main\n", i);
-#endif
- if (sem_wait (&tell_main) == -1)
- {
- if (errno != EINTR)
- {
- fprintf (stderr, "main %d wait on sem tell_main failed\n", i);
- print_error ();
- return;
- }
+ {
+ while (1)
+ {
#ifdef START_DEBUG
- fprintf (stderr, "main %d wait tell_main got EINTR, rewaiting\n", i);
+ fprintf (stderr, "main %d start wait on tell_main\n", i);
#endif
- }
- }
- while (errno == EINTR);
+ if (sem_wait (&tell_main) == 0)
+ break;
+ if (errno == EINTR)
+ {
#ifdef START_DEBUG
- fprintf (stderr, "main %d wait on tell_main\n",i);
+ fprintf (stderr, "main %d wait tell_main got EINTR, rewaiting\n", i);
#endif
- }
+ continue;
+ }
+ else
+ {
+ fprintf (stderr, "main %d wait on sem tell_main failed\n", i);
+ print_error ();
+ return;
+ }
+ }
+ }
#ifdef START_DEBUG
fprintf (stderr, "main done waiting on tell_main\n");
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index 53376264e51..3f74993daa0 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -212,6 +212,7 @@ check_thread_local "third"
gdb_test "continue" ".*Breakpoint 3.*still alive.*" "continue to synch point"
+set no_of_threads 0
send_gdb "info thread\n"
gdb_expect {
-re "^info thread\[ \t\r\n\]+(\[0-9\]+) Thread.*$gdb_prompt $" {