2003-07-29 Michael Chastain <mec@shout.net>
authorMichael Chastain <mec@google.com>
Tue, 29 Jul 2003 21:51:25 +0000 (21:51 +0000)
committerMichael Chastain <mec@google.com>
Tue, 29 Jul 2003 21:51:25 +0000 (21:51 +0000)
* 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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/tls.c
gdb/testsuite/gdb.threads/tls.exp

index 4bcac1be58618af30a3180af874365210d2a5959..cf8bf89867fe8670e10f48a96ca2802dd5e74f1a 100644 (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
index c4f6a30432c91bcbb50b6e6fbb74abc793c1fc08..9b2145e652ff4c9de4eb549b29dfb060bca7882e 100644 (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;
-
-#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");
index 53376264e510ab8666a5e0b8fef0f62c86cbdcf7..3f74993daa05b0242ddf2e4b5eb00bcb8479c95b 100644 (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 $" {
This page took 0.031092 seconds and 4 git commands to generate.