1. Use ring buffers to exchange data, threadWrite-> buf-> threadRead
threadWrite {
memcpy(buf[pushCount & mask], value, size);
pushCountPP;
...
}
threadRead {
...
}
if mask = = 2, pushCount accumulates from 0
when pushCount = 0
pushCount & mask = = 0
when pushCount = 1
pushCount & mask = = 0
when pushCount = 2
pushCount & mask = = 2
is there a problem? the second position of the array is not written, and the first position is written twice
.2. Is there any special requirement for the mask mask of the ring queue, such as parity and so on? please answer
.