Skip to content

Implement Write Lock Downgrading #62

@orthur2

Description

@orthur2

Currently, if a task holding a write lock finishes modifying data and wants to allow concurrent reads, it must drop the write lock and then re-acquire a read lock. This process is inefficient and can introduce potential race conditions in the time between dropping the write lock and acquiring the read lock.

This was identified as a potential future improvement during the work on PR #61.

This issue proposes adding a downgrade() method to RwLockWriteGuard. This would allow a task to atomically convert an exclusive write lock into a read lock (RwLockReadGuard).This improves performance and throughput by allowing read operations to proceed immediately without contention from other pending write locks.

This is a common and proven feature in other major Rust libraries:

And I would like to work on this issue.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions