Browse Source

Initialise the psend mutex and conditionals before launching any threads preventing a deadlock on proxy startup.

master
Con Kolivas 7 years ago
parent
commit
a4045ac46c
  1. 4
      src/generator.c

4
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); create_pthread(&proxy->pth_precv, passthrough_recv, proxy);
proxy->passsends = create_ckmsgq(ckp, "passsend", &passthrough_send); proxy->passsends = create_ckmsgq(ckp, "passsend", &passthrough_send);
} else { } else {
prepare_proxy(proxy);
create_pthread(&gdata->pth_uprecv, userproxy_recv, ckp);
mutex_init(&gdata->psend_lock); mutex_init(&gdata->psend_lock);
cond_init(&gdata->psend_cond); cond_init(&gdata->psend_cond);
prepare_proxy(proxy);
create_pthread(&gdata->pth_uprecv, userproxy_recv, ckp);
create_pthread(&gdata->pth_psend, proxy_send, ckp); create_pthread(&gdata->pth_psend, proxy_send, ckp);
} }
} }

Loading…
Cancel
Save