From: Michael Chastain Date: Tue, 29 Jul 2003 21:51:25 +0000 (+0000) Subject: 2003-07-29 Michael Chastain X-Git-Tag: ezannoni_pie-20030916-branchpoint~576 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51514e061b222877bfd594484905ab3693c837e8;p=platform%2Fupstream%2Fbinutils.git 2003-07-29 Michael Chastain * 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. --- 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 + + * 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 * 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 $" {