]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
If we return from a signal handler to a thread that was waiting to
authorTom Hughes <tom@compton.nu>
Wed, 25 Aug 2004 18:58:04 +0000 (18:58 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 25 Aug 2004 18:58:04 +0000 (18:58 +0000)
rendezvous with another thread before the signal arrived then check
whether the rendezvous is now complete or we may deadlock.

CCMAIL: 77369-done@bugs.kde.org

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

coregrind/vg_scheduler.c

index fbe80dd0dc9e89e0f276b958f400813349ec16da..ceede65ee39d3eff0ac9ecb55579a7d786a725ef 100644 (file)
@@ -97,6 +97,7 @@ static Addr __libc_freeres_wrapper;
 static void do_client_request ( ThreadId tid );
 static void scheduler_sanity ( void );
 static void do_pthread_cond_timedwait_TIMEOUT ( ThreadId tid );
+static void maybe_rendezvous_joiners_and_joinees ( void );
 
 /* Stats. */
 static UInt n_scheduling_events_MINOR = 0;
@@ -618,6 +619,14 @@ void handle_signal_return ( ThreadId tid )
 
    restart_blocked_syscalls = VG_(signal_returns)(tid);
 
+   /* If we were interrupted in the middle of a rendezvous
+      then check the rendezvous hasn't completed while we
+      were busy handling the signal. */
+   if (VG_(threads)[tid].status == VgTs_WaitJoiner ||
+       VG_(threads)[tid].status == VgTs_WaitJoinee ) {
+      maybe_rendezvous_joiners_and_joinees();
+   }
+
    if (restart_blocked_syscalls)
       /* Easy; we don't have to do anything. */
       return;