]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Treat a thread which is waiting to be reaped (ie one with a status
authorTom Hughes <tom@compton.nu>
Sun, 15 Aug 2004 14:34:02 +0000 (14:34 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 15 Aug 2004 14:34:02 +0000 (14:34 +0000)
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

coregrind/vg_scheduler.c

index f60387797e45df1c6fac621be7dd6c1210e188cf..94adac15d29e05d22c2f139d06b65e2d5ff86ef0 100644 (file)
@@ -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);