From: Tassilo von Parseval Date: Sun, 7 Aug 2005 07:10:00 +0000 (+0000) Subject: make threads.xs emit warnings properly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4447dfc12157eb387a12bf297bbc4f4c8c49a7a6;p=p5sagit%2Fp5-mst-13.2.git make threads.xs emit warnings properly Message-id: <20050807051041.GA3924@ethan> p4raw-id: //depot/perl@25307 --- diff --git a/ext/threads/threads.pm b/ext/threads/threads.pm index 22180ad..c320d1c 100755 --- a/ext/threads/threads.pm +++ b/ext/threads/threads.pm @@ -50,7 +50,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( async ); -our $VERSION = '1.06'; +our $VERSION = '1.07'; # || 0 to ensure compatibility with previous versions diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index 03cb590..d80f093 100755 --- a/ext/threads/threads.xs +++ b/ext/threads/threads.xs @@ -168,8 +168,9 @@ Perl_ithread_hook(pTHX) int veto_cleanup = 0; MUTEX_LOCK(&create_destruct_mutex); if (aTHX == PL_curinterp && active_threads != 1) { - Perl_warn(aTHX_ "A thread exited while %" IVdf " threads were running", - (IV)active_threads); + if (ckWARN_d(WARN_THREADS)) + Perl_warn(aTHX_ "A thread exited while %" IVdf " threads were running", + (IV)active_threads); veto_cleanup = 1; } MUTEX_UNLOCK(&create_destruct_mutex); @@ -304,7 +305,7 @@ Perl_ithread_run(void * arg) { SV *sv = POPs; av_store(params, i, SvREFCNT_inc(sv)); } - if (SvTRUE(ERRSV)) { + if (SvTRUE(ERRSV) && ckWARN_d(WARN_THREADS)) { Perl_warn(aTHX_ "thread failed to start: %" SVf, ERRSV); } FREETMPS; @@ -566,14 +567,12 @@ Perl_ithread_self (pTHX_ SV *obj, char* Class) void Perl_ithread_CLONE(pTHX_ SV *obj) { - if (SvROK(obj)) - { - ithread *thread = SV_to_ithread(aTHX_ obj); - } - else - { - Perl_warn(aTHX_ "CLONE %" SVf,obj); - } + if (SvROK(obj)) { + ithread *thread = SV_to_ithread(aTHX_ obj); + } + else if (ckWARN_d(WARN_THREADS)) { + Perl_warn(aTHX_ "CLONE %" SVf,obj); + } } AV* diff --git a/pod/perldiag.pod b/pod/perldiag.pod index e2555a6..729d149 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -193,7 +193,7 @@ know which context to supply to the right side. =item A thread exited while %d threads were running -(W) When using threaded Perl, a thread (not necessarily the main +(W threads)(S) When using threaded Perl, a thread (not necessarily the main thread) exited while there were still other threads running. Usually it's a good idea to first collect the return values of the created threads by joining them, and only then exit from the main @@ -3875,7 +3875,7 @@ target of the change to =item thread failed to start: %s -(S) The entry point function of threads->create() failed for some reason. +(W threads)(S) The entry point function of threads->create() failed for some reason. =item times not implemented