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.
This commit is contained in:
Michael Chastain 2003-07-29 21:51:25 +00:00
parent 735979c782
commit 51514e061b
3 changed files with 42 additions and 35 deletions

View File

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

View File

@ -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;
{
while (1)
{
#ifdef START_DEBUG
fprintf (stderr, "main %d start wait on tell_main\n", i);
#endif
if (sem_wait (&tell_main) == 0)
break;
if (errno == EINTR)
{
#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;
}
#ifdef START_DEBUG
fprintf (stderr, "main %d wait tell_main got EINTR, rewaiting\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;
}
}
}
while (errno == EINTR);
#ifdef START_DEBUG
fprintf (stderr, "main %d wait on tell_main\n",i);
#endif
}
}
#ifdef START_DEBUG
fprintf (stderr, "main done waiting on tell_main\n");

View File

@ -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 $" {