author | Sebastian Harl <sh@tokkee.org> | |
Mon, 30 May 2016 18:54:42 +0000 (20:54 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 30 May 2016 18:54:42 +0000 (20:54 +0200) |
perl plugin: Synchronize access to thread information.
Cf. #1706
Cf. #1706
1 | 2 | |||
---|---|---|---|---|
src/perl.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc src/perl.c
index 92a162bd1acb4a1a347f0a324e1d35605e3da64c,5e03e3a5e8d5d625925160493941c1cabcccf582..f90761a561d20bc72b9988c9b7ca0abf81d85516
--- 1/src/perl.c
--- 2/src/perl.c
+++ b/src/perl.c
#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);