Skip to content

Commit

Permalink
Merge pull request #879 from mtsmfm/consider-falsy-in-compute-if-absent
Browse files Browse the repository at this point in the history
Consider falsy value on `Concurrent::Map#compute_if_absent` fast non-blocking path
  • Loading branch information
pitr-ch committed Jul 22, 2020
2 parents d9efb08 + e3ceb30 commit 6fd8da7
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -19,7 +19,7 @@ def []=(key, value)
end

def compute_if_absent(key)
if stored_value = _get(key) # fast non-blocking path for the most likely case
if NULL != (stored_value = @backend.fetch(key, NULL)) # fast non-blocking path for the most likely case
stored_value
else
@write_lock.synchronize { super }
Expand Down

0 comments on commit 6fd8da7

Please sign in to comment.