Browse Source

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

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

4
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,6 +648,8 @@ 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 (!++test_cycle) {
/* Test for pthread join every 256 messages */
if (unlikely(!pthread_tryjoin_np(cdata->pth_sender, NULL))) { if (unlikely(!pthread_tryjoin_np(cdata->pth_sender, NULL))) {
LOGEMERG("Connector sender thread shutdown, exiting"); LOGEMERG("Connector sender thread shutdown, exiting");
ret = 1; ret = 1;
@ -657,6 +660,7 @@ retry:
ret = 1; ret = 1;
goto out; goto out;
} }
}
Close(sockd); Close(sockd);
sockd = accept(us->sockd, NULL, NULL); sockd = accept(us->sockd, NULL, NULL);

Loading…
Cancel
Save