Skip to content

Commit

Permalink
getlockfile.lk
Browse files Browse the repository at this point in the history
  • Loading branch information
josePereiro committed Jan 4, 2025
1 parent b3ce81d commit 15d7c81
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/1.AbstractBlobBase/lock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ function getlockfile(ab::AbstractBlob, args...)
B = bloberia(ab)
# filepath
_file = _pidfile_path(ab, args...; B)
gettemp!(B, _file) do
return SimpleLockFile(_file)
# To avoid
# AssertionError: Multiple concurrent writes to Dict detected!
# Im locking the access to the getlockfile
# TODO: reseach about the best way to do this.
lk = gettemp!(B, "getlockfile.lk") do
ReentrantLock()
end
return lock(lk) do
gettemp!(B, _file) do
return SimpleLockFile(_file)
end
end
end

Expand Down

0 comments on commit 15d7c81

Please sign in to comment.