Provide a safer alternative for some CheckedUnsafePtr use cases
Categories
(Core :: Storage: Quota Manager, task, P2)
Tracking
()
People
(Reporter: janv, Assigned: janv)
References
(Blocks 1 open bug)
Details
Attachments
(6 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
We have many cases where we use CheckedUnsafePtr
just to make sure that we get notified (by an assertion) that an object is being destroyed before it was removed from a global hash table or an array. Ordinary replacement of CheckedUnsafePtr
with RefPtr
would make it hard to find out where we miss an unregisteration in a global hash table/array (global tracking would keep the object alive forever). I think we can create a safer alternative to CheckedUnsafePtr
which would preserve the checks/assertions for a missing unregistration.
This can lead to elimination of CheckedUnsafePtr
for good.
Assignee | ||
Comment 1•9 days ago
|
||
Assignee | ||
Comment 2•2 days ago
|
||
This is a new version of D215351 which addresses some initial design comments.
A thread safe version of RefCountedSharedObject should be able to avoid a
static mutex and use std::atomic.
The new design is not limited to always trigger a diagnostic assertion. It
allows to do custom checks and cleanup when the holder becomes the last one
holding a strong ref to the object.
Assignee | ||
Comment 3•1 day ago
|
||
This is only a demo patch, not intended for landing.
Assignee | ||
Comment 4•15 hours ago
|
||
Assignee | ||
Comment 5•15 hours ago
|
||
Assignee | ||
Comment 6•13 hours ago
|
||
Description
•