[collectd] [PATCH] perl plugin: Execute END blocks in main thread only.
Sebastian Harl
sh at tokkee.org
Tue Nov 20 08:45:22 CET 2007
Each END block is executed during perl_destruct() which happens once for each
ithread. As the number of ithreads are in no way related to any Perl plugins
this is not what we want. Now, each END block is only executed when the main
threads terminates (which happens after any other Perl thread has been shut
down).
Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
src/perl.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/perl.c b/src/perl.c
index c109de9..5cec1ed 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -779,6 +779,7 @@ static XS (Collectd_call_by_name)
static c_ithread_t *c_ithread_create (PerlInterpreter *base)
{
c_ithread_t *t = NULL;
+ dTHXa (NULL);
assert (NULL != perl_threads);
@@ -789,6 +790,14 @@ static c_ithread_t *c_ithread_create (PerlInterpreter *base)
? NULL
: perl_clone (base, CLONEf_KEEP_PTR_TABLE);
+ aTHX = t->interp;
+
+ if (NULL != base) {
+ av_clear (PL_endav);
+ av_undef (PL_endav);
+ PL_endav = Nullav;
+ }
+
#if COLLECT_DEBUG
++perl_threads->number_of_threads;
#endif /* COLLECT_DEBUG */
--
1.5.3.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20071120/ec10a567/attachment.pgp
More information about the collectd
mailing list