Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does HTTPFields._Storage have a lock? #52

Open
Joannis opened this issue May 19, 2024 · 1 comment
Open

Why does HTTPFields._Storage have a lock? #52

Joannis opened this issue May 19, 2024 · 1 comment
Labels
kind/support Adopter support requests.

Comments

@Joannis
Copy link
Contributor

Joannis commented May 19, 2024

Since it's handled as CoW through isKnownUniquelyReferenced, I would not expect to need a lock.

@guoye-zhang
Copy link
Contributor

The lock is necessary for the index which is built lazily upon access. It’s possible that multiple immutable fields instances share the same storage without an index, and multiple threads call methods that need the index in parallel.

@guoye-zhang guoye-zhang added the kind/support Adopter support requests. label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Adopter support requests.
Projects
None yet
Development

No branches or pull requests

2 participants