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

fix lock usage #38

Merged
merged 2 commits into from
Apr 11, 2023
Merged

Conversation

ericphanson
Copy link
Member

@ericphanson ericphanson commented Apr 10, 2023

closes #31

There are already tests which should cover this, but they don't seem to be causing issues on main. I did check that the original example from #31,

import Memoize: @memoize
import LRUCache: LRU

@memoize LRU{Int,Int}(maxsize=1000) foo(i::Int) = i

foo(5)

does now work (it throws an error no matter how many times I call it), whereas for me on main it throws an error, but then a second invocation of foo hangs.

Here I use Base.@lock, which is document+exported on Julia 1.9+, so should be fine to use here (non-internal).
Nevermind, @lock isn't defined on 1.0, so I'll just use manual finally calls.

@ericphanson
Copy link
Member Author

CI failure seems unrelated
Screenshot 2023-04-10 at 7 08 21 PM

@ararslan ararslan merged commit 6186771 into JuliaCollections:master Apr 11, 2023
@ericphanson ericphanson deleted the eph/fix-locks branch April 11, 2023 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exceptions in get! may cause lock to not be released
2 participants