diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2024-11-24 16:54:16 -0800 |
|---|---|---|
| committer | kat <kat@vector35.com> | 2025-01-10 12:23:07 -0500 |
| commit | 1dc9179158d8af2555e9182c6e0425b86d378909 (patch) | |
| tree | 8e95d6a616ee84d2d4f017c0052db99f065cc503 /python/basicblock.py | |
| parent | 7630dcd1686e56a51d71545a5ac4880410b429d5 (diff) | |
[SharedCache] Split view-specific state into a separate struct
The existing view-specific state was stored in several global unordered
maps. Many of these were accessed without locking, including
`viewSpecificMutexes`, which is racy in the face of multiple threads.
View-specific state is stored in a new heap-allocated
`ViewSpecificState` struct that is reference counted via
`std::shared_ptr`. A static map holds a `std::weak_ptr` to each
view-specific state, keyed by session id. `SharedCache` retrieves its
view-specific state during its constructor.
Since `ViewSpecificState` is reference counted it will naturally be
deallocated when the last `SharedCache` instance that references it goes
away. Its corresponding entry will remain in the static map, though
since it only holds a `std::weak_ptr` rather than any state it will not
use much memory. The next time view-specific state is retrieved any
expired entries will be removed from the map.
Diffstat (limited to 'python/basicblock.py')
0 files changed, 0 insertions, 0 deletions
