From a4045ac46ce4be8f7c0b742ad96d38b46d541762 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 7 Feb 2018 12:09:56 +1100 Subject: [PATCH] Initialise the psend mutex and conditionals before launching any threads preventing a deadlock on proxy startup. --- src/generator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index 61cf4464..a2fa7f47 100644 --- a/src/generator.c +++ b/src/generator.c @@ -3409,10 +3409,10 @@ static void proxy_mode(ckpool_t *ckp, proc_instance_t *pi) create_pthread(&proxy->pth_precv, passthrough_recv, proxy); proxy->passsends = create_ckmsgq(ckp, "passsend", &passthrough_send); } else { - prepare_proxy(proxy); - create_pthread(&gdata->pth_uprecv, userproxy_recv, ckp); mutex_init(&gdata->psend_lock); cond_init(&gdata->psend_cond); + prepare_proxy(proxy); + create_pthread(&gdata->pth_uprecv, userproxy_recv, ckp); create_pthread(&gdata->pth_psend, proxy_send, ckp); } }