mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1575442 - BlocksRingBuffer::LockAndRun - r=gregtatum
Some users will want to lock the buffer but not do any specific operation with it. Differential Revision: https://phabricator.services.mozilla.com/D42824 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
94aab56280
commit
608cb489b5
@ -290,6 +290,15 @@ class BlocksRingBuffer {
|
||||
std::forward<EntryDestructor>(aEntryDestructor));
|
||||
}
|
||||
|
||||
// Lock the buffer mutex and run the provided callback.
|
||||
// This can be useful when the caller needs to explicitly lock down this
|
||||
// buffer, but not do anything else with it.
|
||||
template <typename Callback>
|
||||
auto LockAndRun(Callback&& aCallback) const {
|
||||
baseprofiler::detail::BaseProfilerAutoLock lock(mMutex);
|
||||
return std::forward<Callback>(aCallback)();
|
||||
}
|
||||
|
||||
// Buffer length in bytes.
|
||||
Maybe<PowerOfTwo<Length>> BufferLength() const {
|
||||
baseprofiler::detail::BaseProfilerAutoLock lock(mMutex);
|
||||
|
Loading…
Reference in New Issue
Block a user