Switch read-heavy Mutex fields to RwLock for concurrent reads#95
Open
Switch read-heavy Mutex fields to RwLock for concurrent reads#95
Conversation
Replace parking_lot::Mutex with RwLock on TauriState.config, PluginState.panels, and PluginState.menu_items. These fields are read on nearly every Tauri command but written only on settings save or plugin enable/disable. RwLock allows concurrent readers while still providing exclusive write access when needed. - TauriState.config: .read() for all query commands, .write() only in save_settings - PluginState.panels: .read() for get_plugin_panels/get_panel_widgets, .write() for register_panel/set_widgets/cleanup - PluginState.menu_items: .read() for get_plugin_menu_items/menu rebuild, .write() for register_menu_item/cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Replaces
parking_lot::Mutexwithparking_lot::RwLockfor three read-heavy shared state fields:TauriState.configPluginState.panelsPluginState.menu_items36 call sites updated across 6 files. Read-only access uses
.read(), mutations use.write().Type of change
Testing