Provide a generic keep alive mechanism
Categories
(Core :: Storage: Quota Manager, task, P2)
Tracking
()
People
(Reporter: janv, Assigned: janv)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 3 obsolete files)
We have many cases where we use CheckedUnsafePtr to ensure that we get notified (by an assertion) if an object is being destroyed before it is removed from a global hash table or array. Simply replacing CheckedUnsafePtr with RefPtr would make it hard to identify where we missed an unregistration in a global hash table or array (global tracking would keep the object alive forever). I believe we can create a generic keep-alive mechanism that would prevent lifecycle issues as much as possible, so diagnostic assertions wouldn't be needed anymore. This would eventually lead to replacing CheckedUnsafePtr with ordinary RefPtr in global hash tables or arrays.
| Assignee | ||
Comment 1•1 year ago
|
||
| Assignee | ||
Comment 2•1 year 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 year ago
|
||
This is only a demo patch, not intended for landing.
| Assignee | ||
Comment 4•1 year ago
|
||
| Assignee | ||
Comment 5•1 year ago
|
||
| Assignee | ||
Comment 6•1 year ago
|
||
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Description
•