commit 2b847fd9ecb4fef268797d0cfec455ad46ca1656
Author: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Date:   Sun Jan 6 16:30:08 2019 +0100

    pthread: mt_queue_start_lim: make sure worker is not a clone

diff --git a/src/mt/pthread.c b/src/mt/pthread.c
index dd14ed435d..93a1270dec 100644
--- a/src/mt/pthread.c
+++ b/src/mt/pthread.c
@@ -324,6 +324,8 @@ mt_queue_start_lim(struct pari_mt *pt, GEN worker, long lim)
     long mtparisize = GP_DATA->threadsize? GP_DATA->threadsize: pari_mainstack->rsize;
     long mtparisizemax = GP_DATA->threadsizemax;
     long i;
+    if (isclone(worker))
+      worker = gcopy(worker); /* to avoid clone_lock race */
     mt->mq  = (struct mt_queue *) pari_malloc(sizeof(*mt->mq)*lim);
     mt->th  = (pthread_t *) pari_malloc(sizeof(*mt->th)*lim);
     mt->pth = (struct pari_thread *) pari_malloc(sizeof(*mt->pth)*lim);
