]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
cleanup_after_thread_exited: also clean up the waiting_fds table on thread
authorJulian Seward <jseward@acm.org>
Sun, 30 Jun 2002 10:57:30 +0000 (10:57 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 30 Jun 2002 10:57:30 +0000 (10:57 +0000)
disappearance.  This fixes an assertion failure to do with thread nukage
on fork():
   vg_scheduler.c:936 (poll_for_ready_fds):
   Assertion `vgPlain_is_valid_tid(tid)' failed.

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

coregrind/vg_scheduler.c
vg_scheduler.c

index 796ca7ee7380f3a3fe963483fd746730ac8bf964..076b160ef562289c9dbf7a810936433bb36ad281 100644 (file)
@@ -1493,6 +1493,7 @@ void make_thread_jump_to_cancelhdlr ( ThreadId tid )
 static
 void cleanup_after_thread_exited ( ThreadId tid )
 {
+   Int           i;
    vki_ksigset_t irrelevant_sigmask;
    vg_assert(VG_(is_valid_or_empty_tid)(tid));
    vg_assert(VG_(threads)[tid].status == VgTs_Empty);
@@ -1505,6 +1506,13 @@ void cleanup_after_thread_exited ( ThreadId tid )
       this thread. */
    VG_(block_all_host_signals)( &irrelevant_sigmask );
    VG_(handle_SCSS_change)( False /* lazy update */ );
+
+   /* Clean up the waiting_fd table */
+   for (i = 0; i < VG_N_WAITING_FDS; i++) {
+      if (vg_waiting_fds[i].tid == tid) {
+         vg_waiting_fds[i].fd = -1; /* not in use */
+      }
+   }
 }
 
 
index 796ca7ee7380f3a3fe963483fd746730ac8bf964..076b160ef562289c9dbf7a810936433bb36ad281 100644 (file)
@@ -1493,6 +1493,7 @@ void make_thread_jump_to_cancelhdlr ( ThreadId tid )
 static
 void cleanup_after_thread_exited ( ThreadId tid )
 {
+   Int           i;
    vki_ksigset_t irrelevant_sigmask;
    vg_assert(VG_(is_valid_or_empty_tid)(tid));
    vg_assert(VG_(threads)[tid].status == VgTs_Empty);
@@ -1505,6 +1506,13 @@ void cleanup_after_thread_exited ( ThreadId tid )
       this thread. */
    VG_(block_all_host_signals)( &irrelevant_sigmask );
    VG_(handle_SCSS_change)( False /* lazy update */ );
+
+   /* Clean up the waiting_fd table */
+   for (i = 0; i < VG_N_WAITING_FDS; i++) {
+      if (vg_waiting_fds[i].tid == tid) {
+         vg_waiting_fds[i].fd = -1; /* not in use */
+      }
+   }
 }