]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Check for signals to be delivered after every syscall. This avoids
authorJulian Seward <jseward@acm.org>
Fri, 12 Jul 2002 01:23:03 +0000 (01:23 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 12 Jul 2002 01:23:03 +0000 (01:23 +0000)
some obscure deadlock cases.  (Neil Conway).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@487

coregrind/vg_scheduler.c
vg_scheduler.c

index 8881f9ae64c5312ad5c40f077aec1aa1ab0f39dc..74af761290a7d6e37006158d803d30f0caec817f 100644 (file)
@@ -1368,10 +1368,17 @@ VgSchedReturnCode VG_(scheduler) ( void )
             }
 #           endif
 
-            if (VG_(threads)[tid].status == VgTs_Runnable)
+            if (VG_(threads)[tid].status == VgTs_Runnable) {
+               /* Better do a signal check, since if in a tight loop
+                  with a slow syscall it may be a very long time
+                  before we get back to the main signal check in Stage 1. */
+               sigs_delivered = VG_(deliver_signals)();
+               if (sigs_delivered)
+                  VG_(do_sanity_checks)( False );
                continue; /* with this thread */
-            else
-               goto stage1;          
+            } else {
+               goto stage1;
+            }
         }
 
         /* It's an event we can't quickly deal with.  Give up running
index 8881f9ae64c5312ad5c40f077aec1aa1ab0f39dc..74af761290a7d6e37006158d803d30f0caec817f 100644 (file)
@@ -1368,10 +1368,17 @@ VgSchedReturnCode VG_(scheduler) ( void )
             }
 #           endif
 
-            if (VG_(threads)[tid].status == VgTs_Runnable)
+            if (VG_(threads)[tid].status == VgTs_Runnable) {
+               /* Better do a signal check, since if in a tight loop
+                  with a slow syscall it may be a very long time
+                  before we get back to the main signal check in Stage 1. */
+               sigs_delivered = VG_(deliver_signals)();
+               if (sigs_delivered)
+                  VG_(do_sanity_checks)( False );
                continue; /* with this thread */
-            else
-               goto stage1;          
+            } else {
+               goto stage1;
+            }
         }
 
         /* It's an event we can't quickly deal with.  Give up running