perl plugin: Changed pluginname form to allow single perl plugin flush. (Part 2,...
[collectd.git] / src / perl.c
index 04745c8..700bb98 100644 (file)
@@ -1229,6 +1229,10 @@ static void c_ithread_destroy (c_ithread_t *ithread)
        assert (NULL != perl_threads);
 
        PERL_SET_CONTEXT (aTHX);
+       /* Mark as running to avoid deadlock:
+          c_ithread_destroy -> log_debug -> perl_log()
+       */
+       ithread->running = 1;
        log_debug ("Shutting down Perl interpreter %p...", aTHX);
 
 #if COLLECT_DEBUG
@@ -1728,8 +1732,6 @@ typedef int perl_unregister_function_t(const char *name);
 static void _plugin_unregister_generic (pTHX,
                                perl_unregister_function_t *unreg, const char *desc)
 {
-       char cb_name[DATA_MAX_NAME_LEN];
-
        dXSARGS;
 
        if (1 != items) {
@@ -1746,9 +1748,7 @@ static void _plugin_unregister_generic (pTHX,
        log_debug ("Collectd::plugin_unregister_%s: plugin = \"%s\"",
                        desc, SvPV_nolen (ST (0)));
 
-       ssnprintf (cb_name, sizeof (cb_name), "perl/%s", SvPV_nolen (ST (0)));
-
-       unreg(cb_name);
+       unreg(SvPV_nolen (ST (0)));
 
        XSRETURN_EMPTY;
 
@@ -2371,10 +2371,6 @@ static int perl_shutdown (void)
                        pthread_kill (thr->pthread, SIGTERM);
                        ERROR ("perl shutdown: Thread hangs inside Perl. Thread killed.");
                }
-               /* Mark as running to avoid deadlock:
-                  c_ithread_destroy -> log_debug -> perl_log()
-               */
-               thr->running = 1; 
                c_ithread_destroy (thr);
        }