Improve Base Profiler mutexes
Categories
(Core :: Gecko Profiler, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
References
Details
Attachments
(2 files)
baseprofiler::PSMutex and BlocksRingBuffer::RBMutex are pretty much the same, they could be unified in one class.
Also we should offer features similar to xpcom's Mutex, which can verify that the current thread owns the mutex, and can detect recursive locking.
This should help both our internal implementations, and its use by callers and their callbacks.
Assignee | ||
Comment 1•5 years ago
|
||
BPMutex is a concrete mutex based on MutexImpl, which was previously implemented
twice in both platform.h and BlocksRingBuffer.h.
This combined BPMutex
has some DEBUG code (when MOZ_BASE_PROFILER is #defined)
to catch recursive locking, and to assert that the mutex is held (for code that
cannot easily use the "proof of lock" pattern; e.g., going through user-provided
callbacks).
This class needs to be public (because it is used in public headers), but is an
implementation detail, so it is located in a new header
"mozilla/BaseProfilerDetail.h" that will collect mozilla::baseprofiler::detail
code that may be useful to a few files in Base Profiler.
Depends on D38846
Assignee | ||
Comment 2•5 years ago
|
||
This of course checks that the mutex is locked as expected in non-public APIs.
It also checks that user callbacks will not keep readers/writers longer than
they should.
Depends on D39624
Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3357c0982cc2 Unify Base Profiler mutexes into one class - r=gregtatum https://hg.mozilla.org/integration/autoland/rev/dee618137651 Use mMutex.AssertCurrentThreadOwns() in BlocksRingBuffer - r=gregtatum
Comment 4•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3357c0982cc2
https://hg.mozilla.org/mozilla-central/rev/dee618137651
Description
•