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
This commit is contained in:
Thomas Preud'homme 2011-05-10 11:02:00 +02:00
parent 70f8f95647
commit 6fcfd60d2d
1 changed files with 1 additions and 2 deletions

View File

@ -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;