AleoNet / snarkVM

A Virtual Machine for Zero-Knowledge Executions
https://snarkvm.org
Apache License 2.0
1.06k stars 1.49k forks source link

`RwLock.read()` instead of `RwLock.write()` #2504

Closed ghostant-1017 closed 3 months ago

ljedrz commented 3 months ago

I think I recall these, but counter-intuitively these need to be write, since the collection in question is an LruCache, no?

Edit: indeed, this is the signature of get.

ghostant-1017 commented 3 months ago

I think I recall these, but counter-intuitively these need to be write, since the collection in question is an LruCache, no?

Edit: indeed, this is the signature of get.

Thank you! You are right.

ljedrz commented 3 months ago

That being said, I don't know why that lock was changed to an RwLock, as only write guards are used, meaning Mutex would be a better fit.