epicsRingBytes: fix reversed operands in ResetHighWaterMark
The used-bytes count is nextPut - nextGet everywhere else in this file (epicsRingBytesPut, epicsRingBytesUsedBytes), but epicsRingBytesResetHighWaterMark computed nextGet - nextPut. For a ring holding u bytes it therefore stored size-u; since Put only raises the mark, the high-water mark stayed permanently inflated and wrong. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fde8e4ca2e
commit
1732c7dbd7
1 file changed
+1
-1
@@ -244,7 +244,7 @@ LIBCOM_API void epicsStdCall epicsRingBytesResetHighWaterMark(epicsRingBytesId i
|
||||
ringPvt *pring = (ringPvt *)id;
|
||||
int used;
|
||||
if (pring->lock) epicsSpinLock(pring->lock);
|
||||
used = pring->nextGet - pring->nextPut;
|
||||
used = pring->nextPut - pring->nextGet;
|
||||
if (used < 0) used += pring->size;
|
||||
pring->highWaterMark = used;
|
||||
if (pring->lock) epicsSpinUnlock(pring->lock);
|
||||
|
||||
Reference in new issue
Block a user