Skip to content

Commit 730dcf0

Browse files
committed
fix: @lock unavailable on 1.6
1 parent ee88b23 commit 730dcf0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Strings.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const OP_NAME_CACHE = (; x=Dict{UInt64,Vector{Char}}(), lock=Threads.SpinLock())
2323

2424
function get_op_name(op)
2525
h = hash(op)
26-
@lock OP_NAME_CACHE.lock let
26+
lock(OP_NAME_CACHE.lock)
27+
try
2728
cache = OP_NAME_CACHE.x
2829
if haskey(cache, h)
2930
return cache[h]
@@ -43,6 +44,8 @@ function get_op_name(op)
4344
end
4445
cache[h] = op_s
4546
return op_s
47+
finally
48+
unlock(OP_NAME_CACHE.lock)
4649
end
4750
end
4851

0 commit comments

Comments
 (0)