Merge ConsumeAllLocked into ConsumeAll
There no longer needs to be separate locked and unlocked methods now
that the buffer has its own mutex.
The most notable change is that within PollAndSchedule, we go from using
try_lock to using the scoped_lock in ConsumeAll. The try_lock was meant
to prevent the following deadlock:
- Stop() takes mMutex and calls mTaskRunner.reset()
- mTaskRunner awaits completion of final closure (PollAndSchedule)
- PollAndSchedule is blocked trying to acquire mMutex
Now that ConsumeAll depends only on mBufferMutex, a more elegant
solution is to just ensure that Stop() isn't holding mBufferMutex while
calling mTaskRunner.reset().
Bug: 320700806
Test: atest libnetworkstats_test
Change-Id: Id5df18bc5809ba193bbe1aa0b97121bd5a8afdcd
2 files changed