Use only one longpoll as much as possible by using a pthread conditional broadcast that each longpoll thread waits on and checks if it's the current pool before opening its longpoll connection.
@ -2283,6 +2286,10 @@ void switch_pools(struct pool *selected)
@@ -2283,6 +2286,10 @@ void switch_pools(struct pool *selected)
mutex_lock(&qd_lock);
total_queued=0;
mutex_unlock(&qd_lock);
mutex_lock(&lp_lock);
pthread_cond_broadcast(&lp_cond);
mutex_unlock(&lp_lock);
}
staticvoiddiscard_work(structwork*work)
@ -3993,6 +4000,14 @@ static struct pool *select_longpoll_pool(struct pool *cp)
@@ -3993,6 +4000,14 @@ static struct pool *select_longpoll_pool(struct pool *cp)