From e8e6f333fb70a1ac62ee87237d37336cd6767150 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Mon, 19 Jul 1999 04:29:34 +0000 Subject: [PATCH] don't display tid from main thread (or testsuite breaks) p4raw-id: //depot/perl@3702 --- lib/Carp.pm | 12 ++++++++---- util.c | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/Carp.pm b/lib/Carp.pm index 8301f37..3644424 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -176,8 +176,10 @@ sub longmess { # here's where the error message, $mess, gets constructed $mess .= "\t$sub " if $error eq "called"; $mess .= "$error at $file line $line"; - $mess .= " thread " . Thread->self->tid - if exists $main::{'Thread::'}; + if (exists $main::{'Thread::'}) { + my $tid = Thread->self->tid; + $mess .= " thread $tid" if $tid; + } $mess .= "\n"; } # we don't need to print the actual error message again so we can @@ -259,8 +261,10 @@ sub shortmess { # Short-circuit &longmess if called via multiple packages # remove them first. my $msg; $msg = "$error at $file line $line"; - $msg .= " thread " . Thread->self->tid - if exists $main::{'Thread::'}; + if (exists $main::{'Thread::'}) { + my $tid = Thread->self->tid; + $mess .= " thread $tid" if $tid; + } $msg .= "\n"; $msg =~ tr/\0//d; return $msg; diff --git a/util.c b/util.c index aa43861..7c83d03 100644 --- a/util.c +++ b/util.c @@ -1417,7 +1417,8 @@ Perl_mess(pTHX_ const char *pat, va_list *args) (long)IoLINES(GvIOp(PL_last_in_gv))); } #ifdef USE_THREADS - sv_catpvf(sv, " thread %ld", thr->tid); + if (thr->tid) + Perl_sv_catpvf(aTHX_ sv, " thread %ld", thr->tid); #endif sv_catpv(sv, PL_dirty ? dgd : ".\n"); } -- 2.7.4