There's a code in Batch Log processor that contains the following constructs:
while (is_force_flush_.load() == true)
{
cv_.notify_one();
}
These constructs look suspicious, as "what if" the other thread does not refresh the is_force_flush value - does it mean that we are effectively busy-waiting, burning CPU cycles?
Should this be supplemented with some timed idle-wait or with std::thread::yield , or reworked using conditional variables?
Discussed with @open-telemetry/cpp-approvers during SIG call that the code as it is coded - looks funky, but should be fine .. Let's see if it can be reworked long-term to look cleaner.
There's a code in Batch Log processor that contains the following constructs:
These constructs look suspicious, as "what if" the other thread does not refresh the
is_force_flushvalue - does it mean that we are effectively busy-waiting, burning CPU cycles?Should this be supplemented with some timed idle-wait or with std::thread::yield , or reworked using conditional variables?
Discussed with @open-telemetry/cpp-approvers during SIG call that the code as it is coded - looks funky, but should be fine .. Let's see if it can be reworked long-term to look cleaner.