diff options
author | Michael Chastain <mec@google.com> | 2003-07-29 21:51:25 +0000 |
---|---|---|
committer | Michael Chastain <mec@google.com> | 2003-07-29 21:51:25 +0000 |
commit | 51514e061b222877bfd594484905ab3693c837e8 (patch) | |
tree | ffc9489a3a6cc79b169b73fdf6815cb92cd410ec | |
parent | 735979c78294364af204d7fe2fbe1ca14c0923d3 (diff) | |
download | gdb-51514e061b222877bfd594484905ab3693c837e8.zip gdb-51514e061b222877bfd594484905ab3693c837e8.tar.gz gdb-51514e061b222877bfd594484905ab3693c837e8.tar.bz2 |
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.
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/tls.c | 67 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/tls.exp | 1 |
3 files changed, 41 insertions, 34 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4bcac1b..cf8bf89 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +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. + 2003-07-27 Daniel Jacobowitz <drow@mvista.com> * gdb.threads/print-threads.exp (test_all_threads): Loosen KFAIL diff --git a/gdb/testsuite/gdb.threads/tls.c b/gdb/testsuite/gdb.threads/tls.c index c4f6a30..9b2145e 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 5337626..3f74993 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 $" { |