From: Sebastian Harl Date: Mon, 30 May 2016 18:54:42 +0000 (+0200) Subject: Merge pull request #1710 from rpv-tomsk/perl-plugin-fixes X-Git-Tag: collectd-5.6.0~291 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=b81104a423234c04f0eb4ace0ec5e93a363c917a Merge pull request #1710 from rpv-tomsk/perl-plugin-fixes perl plugin: Synchronize access to thread information. Cf. #1706 --- b81104a423234c04f0eb4ace0ec5e93a363c917a diff --cc src/perl.c index 92a162bd,5e03e3a5..f90761a5 --- a/src/perl.c +++ b/src/perl.c @@@ -2249,10 -2317,12 +2311,12 @@@ static int init_pi (int argc, char **ar #endif PERL_SYS_INIT3 (&argc, &argv, &environ); - perl_threads = (c_ithread_list_t *)smalloc (sizeof (c_ithread_list_t)); + perl_threads = smalloc (sizeof (*perl_threads)); memset (perl_threads, 0, sizeof (c_ithread_list_t)); - pthread_mutex_init (&perl_threads->mutex, NULL); + pthread_mutexattr_init(&perl_threads->mutexattr); + pthread_mutexattr_settype(&perl_threads->mutexattr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init (&perl_threads->mutex, &perl_threads->mutexattr); /* locking the mutex should not be necessary at this point * but let's just do it for the sake of completeness */ pthread_mutex_lock (&perl_threads->mutex);