summaryrefslogtreecommitdiffstats
path: root/proxy/src/gp_workers.c
diff options
context:
space:
mode:
Diffstat (limited to 'proxy/src/gp_workers.c')
-rw-r--r--proxy/src/gp_workers.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/proxy/src/gp_workers.c b/proxy/src/gp_workers.c
index 1191221..1a58136 100644
--- a/proxy/src/gp_workers.c
+++ b/proxy/src/gp_workers.c
@@ -378,24 +378,22 @@ static void *gp_worker_main(void *pvt)
while (!t->pool->shutdown) {
- /* wait for next query */
- if (t->query == NULL) {
- /* ======> COND_MUTEX */
- pthread_mutex_lock(&t->cond_mutex);
- while (t->query == NULL) {
- pthread_cond_wait(&t->cond_wakeup, &t->cond_mutex);
- if (t->pool->shutdown) {
- pthread_exit(NULL);
- }
+ /* ======> COND_MUTEX */
+ pthread_mutex_lock(&t->cond_mutex);
+ while (t->query == NULL) {
+ /* wait for next query */
+ pthread_cond_wait(&t->cond_wakeup, &t->cond_mutex);
+ if (t->pool->shutdown) {
+ pthread_exit(NULL);
}
+ }
- /* grab the query off the shared pointer */
- q = t->query;
- t->query = NULL;
+ /* grab the query off the shared pointer */
+ q = t->query;
+ t->query = NULL;
- /* <====== COND_MUTEX */
- pthread_mutex_unlock(&t->cond_mutex);
- }
+ /* <====== COND_MUTEX */
+ pthread_mutex_unlock(&t->cond_mutex);
/* handle the client request */
gp_handle_query(t->pool, q);