summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-02-23 05:48:14 -0800
committerAnand V. Avati <avati@amp.gluster.com>2009-02-23 19:34:02 +0530
commit8b1762971f8d18f73fa64a967c4cd2baa13d07fc (patch)
treeb8bdfef42ad228bee4431eeee65df50a8d3ed678
parenta3ed4474de9db5bda606b374f3d8cb1cdbf8a9fb (diff)
RE-SEND: Add braces around critical sections.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--xlators/performance/io-threads/src/io-threads.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index b3054ae6b..f430117be 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -1027,17 +1027,19 @@ iot_queue (iot_worker_t *worker,
queue->stub = stub;
pthread_mutex_lock (&worker->qlock);
- queue->next = &worker->queue;
- queue->prev = worker->queue.prev;
+ {
+ queue->next = &worker->queue;
+ queue->prev = worker->queue.prev;
- queue->next->prev = queue;
- queue->prev->next = queue;
+ queue->next->prev = queue;
+ queue->prev->next = queue;
- /* dq_cond */
- worker->queue_size++;
- worker->q++;
+ /* dq_cond */
+ worker->queue_size++;
+ worker->q++;
- pthread_cond_broadcast (&worker->dq_cond);
+ pthread_cond_broadcast (&worker->dq_cond);
+ }
pthread_mutex_unlock (&worker->qlock);
}
@@ -1048,17 +1050,19 @@ iot_dequeue (iot_worker_t *worker)
iot_queue_t *queue = NULL;
pthread_mutex_lock (&worker->qlock);
- while (!worker->queue_size)
- pthread_cond_wait (&worker->dq_cond, &worker->qlock);
+ {
+ while (!worker->queue_size)
+ pthread_cond_wait (&worker->dq_cond, &worker->qlock);
- queue = worker->queue.next;
- queue->next->prev = queue->prev;
- queue->prev->next = queue->next;
+ queue = worker->queue.next;
+ queue->next->prev = queue->prev;
+ queue->prev->next = queue->next;
- stub = queue->stub;
+ stub = queue->stub;
- worker->queue_size--;
- worker->dq++;
+ worker->queue_size--;
+ worker->dq++;
+ }
pthread_mutex_unlock (&worker->qlock);
FREE (queue);