From 799e526298807019c085408704a807728758b05c Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 25 Aug 2004 18:58:04 +0000 Subject: [PATCH] If we return from a signal handler to a thread that was waiting to 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index fbe80dd0dc..ceede65ee3 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -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; -- 2.47.2