From 6fcfd60d2d63a33f869b2d2d12277c7e6e622720 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 10 May 2011 11:02:00 +0200 Subject: [PATCH] Fix buffer loop in BatchQueue single data mode The buffer in single data mode in batchQueue was not circular because a variable was not renamed --- communication_techniques/src/communication/batch_queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/communication_techniques/src/communication/batch_queue.c b/communication_techniques/src/communication/batch_queue.c index 3cc892f..0605ca4 100644 --- a/communication_techniques/src/communication/batch_queue.c +++ b/communication_techniques/src/communication/batch_queue.c @@ -37,13 +37,12 @@ int destroy_comm_channel(void *channel) */ void *recv_one_data(struct channel *channel) { - static __thread int i; void *result; if (unlikely(!(channel->receiver_idx % (BUF_SIZE / sizeof(void *))))) while (!channel->state); result = channel->buf[channel->receiver_idx++]; - i %= (2 * BUF_SIZE) / sizeof(void *); + channel->receiver_idx %= (2 * BUF_SIZE) / sizeof(void *); if (unlikely(!(channel->receiver_idx % (BUF_SIZE / sizeof(void *))))) channel->state = 0; return result;