[core] Use lock::RwLock in Registry.

This commit is contained in:
Jim Blandy authored and Connor Fitzgerald committed 2024-04-25 01:28:21 -04:00
1 parent 36e0a135f5
commit 927b7e96fe
2 files changed
+3 -2

No files matched your search

+1
View File
@@ -142,6 +142,7 @@ define_lock_ranks! {
rank DEVICE_TRACKERS "Device::trackers" followed by { }
rank DEVICE_USAGE_SCOPES "Device::usage_scopes" followed by { }
rank IDENTITY_MANAGER_VALUES "IdentityManager::values" followed by { }
rank REGISTRY_STORAGE "Registry::storage" followed by { }
rank RESOURCE_POOL_INNER "ResourcePool::inner" followed by { }
rank SHARED_TRACKER_INDEX_ALLOCATOR_INNER "SharedTrackerIndexAllocator::inner" followed by { }
rank STAGING_BUFFER_RAW "StagingBuffer::raw" followed by { }
+2 -2
View File
@@ -1,11 +1,11 @@
use std::sync::Arc;
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use wgt::Backend;
use crate::{
id::Id,
identity::IdentityManager,
lock::{rank, RwLock, RwLockReadGuard, RwLockWriteGuard},
resource::Resource,
storage::{Element, InvalidId, Storage},
};
@@ -48,7 +48,7 @@ impl<T: Resource> Registry<T> {
pub(crate) fn new(backend: Backend) -> Self {
Self {
identity: Arc::new(IdentityManager::new()),
storage: RwLock::new(Storage::new()),
storage: RwLock::new(rank::REGISTRY_STORAGE, Storage::new()),
backend,
}
}