[commtech] Fix idx test in c_cache technique.
c_cache watching status value when idx % BUF_SIZE != 0 instead of when it's equal zero.
This commit is contained in:
parent
9f5fb833d7
commit
2d879dc3fc
|
@ -82,11 +82,11 @@ void *recv_one_data(void)
|
||||||
static __thread int i;
|
static __thread int i;
|
||||||
void *result;
|
void *result;
|
||||||
|
|
||||||
if (unlikely(i % (BUF_SIZE / sizeof(void *))))
|
if (unlikely(!(i % (BUF_SIZE / sizeof(void *)))))
|
||||||
while (!comm.cons->channel->state);
|
while (!comm.cons->channel->state);
|
||||||
result = (void *) comm.cons->channel->buf[i++];
|
result = (void *) comm.cons->channel->buf[i++];
|
||||||
i %= (2 * BUF_SIZE) / sizeof(void *);
|
i %= (2 * BUF_SIZE) / sizeof(void *);
|
||||||
if (unlikely(i % (BUF_SIZE / sizeof(void *))))
|
if (unlikely(!(i % (BUF_SIZE / sizeof(void *)))))
|
||||||
comm.cons->channel->state = 0;
|
comm.cons->channel->state = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue