From 927b7e96fe02bbf2fc9e56fe412cca2b23d46b71 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 24 Apr 2024 18:17:52 -0700 Subject: [PATCH] [core] Use `lock::RwLock` in `Registry`. --- wgpu-core/src/lock/rank.rs | 1 + wgpu-core/src/registry.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wgpu-core/src/lock/rank.rs b/wgpu-core/src/lock/rank.rs index e377f5b1d..8032c38be 100644 --- a/wgpu-core/src/lock/rank.rs +++ b/wgpu-core/src/lock/rank.rs @@ -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 { } diff --git a/wgpu-core/src/registry.rs b/wgpu-core/src/registry.rs index e898ccdce..f0f5674da 100644 --- a/wgpu-core/src/registry.rs +++ b/wgpu-core/src/registry.rs @@ -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 Registry { 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, } }