From: Tom Hughes Date: Sun, 15 Aug 2004 14:34:02 +0000 (+0000) Subject: Treat a thread which is waiting to be reaped (ie one with a status X-Git-Tag: svn/VALGRIND_2_2_0~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7995acbe9509aba4f6cec780ff80792ae5df908f;p=thirdparty%2Fvalgrind.git Treat a thread which is waiting to be reaped (ie one with a status of VgTs_WaitJoiner) as non-existent for the purposes of cancellation. This ensures that pthread_cancel returns ESRCH instead of trying to cancel the thread, which would lead to the thread cleanup code being run twice. CCMAIL: 86730-done@bugs.kde.org git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2587 --- diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index f60387797e..94adac15d2 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -1713,7 +1713,8 @@ void do__set_cancelpend ( ThreadId tid, vg_assert(VG_(is_valid_tid)(tid)); vg_assert(VG_(threads)[tid].status == VgTs_Runnable); - if (!VG_(is_valid_tid)(cee)) { + if (!VG_(is_valid_tid)(cee) || + VG_(threads)[cee].status == VgTs_WaitJoiner) { if (VG_(clo_trace_sched)) { VG_(sprintf)(msg_buf, "set_cancelpend for invalid tid %d", cee);