From: Tom Hughes Date: Wed, 25 Aug 2004 18:58:04 +0000 (+0000) Subject: If we return from a signal handler to a thread that was waiting to X-Git-Tag: svn/VALGRIND_2_2_0~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=799e526298807019c085408704a807728758b05c;p=thirdparty%2Fvalgrind.git 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 --- 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;