You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before entering the loop the condition is handled for the case when the previous run (oldTime) is older than the earliest possible bucked (minTime) of the buffer window.
However, for the case that compare_exchange_weak fails and newTime is reset to oldTime back again and the loop is re-run, setting it to old time is wrong as it does ignore that case?
if (minTime > oldTime) {
newTime = minTime; // <--- newTime changed
}
for (;;) {
newTime += timeNeeded;
if (newTime > now) {
return false;
}
if (time_.compare_exchange_weak(oldTime, newTime,
std::memory_order_relaxed,
std::memory_order_relaxed)) {
return true;
}
newTime = oldTime; // <-- newTime reset to oldTime, not considering the eventually required shift to minTime
}
The text was updated successfully, but these errors were encountered:
Before entering the loop the condition is handled for the case when the previous run (oldTime) is older than the earliest possible bucked (minTime) of the buffer window.
However, for the case that compare_exchange_weak fails and newTime is reset to oldTime back again and the loop is re-run, setting it to old time is wrong as it does ignore that case?
The text was updated successfully, but these errors were encountered: