Browse Source

Do not check for thread shutdown on every pass through the connector

master
Con Kolivas 10 years ago
parent
commit
d6c57c0817
  1. 22
      src/connector.c

22
src/connector.c

@ -633,6 +633,7 @@ static int connector_loop(proc_instance_t *pi, cdata_t *cdata)
int64_t client_id64, client_id; int64_t client_id64, client_id;
unixsock_t *us = &pi->us; unixsock_t *us = &pi->us;
ckpool_t *ckp = pi->ckp; ckpool_t *ckp = pi->ckp;
uint8_t test_cycle = 0;
char *buf = NULL; char *buf = NULL;
do { do {
@ -647,15 +648,18 @@ static int connector_loop(proc_instance_t *pi, cdata_t *cdata)
LOGWARNING("%s connector ready", ckp->name); LOGWARNING("%s connector ready", ckp->name);
retry: retry:
if (unlikely(!pthread_tryjoin_np(cdata->pth_sender, NULL))) { if (!++test_cycle) {
LOGEMERG("Connector sender thread shutdown, exiting"); /* Test for pthread join every 256 messages */
ret = 1; if (unlikely(!pthread_tryjoin_np(cdata->pth_sender, NULL))) {
goto out; LOGEMERG("Connector sender thread shutdown, exiting");
} ret = 1;
if (unlikely(!pthread_tryjoin_np(cdata->pth_receiver, NULL))) { goto out;
LOGEMERG("Connector receiver thread shutdown, exiting"); }
ret = 1; if (unlikely(!pthread_tryjoin_np(cdata->pth_receiver, NULL))) {
goto out; LOGEMERG("Connector receiver thread shutdown, exiting");
ret = 1;
goto out;
}
} }
Close(sockd); Close(sockd);

Loading…
Cancel
Save