fix race condition relating to retrieving path from cache and aot compilation

This commit is contained in:
Nathan Marz 2016-11-09 06:20:10 -05:00
parent b19ceb8c0c
commit 9178f38465

View file

@ -232,8 +232,13 @@
get-cache-code (if (= platform :clj) get-cache-code (if (= platform :clj)
`(try (i/get-cell ~cache-sym) `(try (i/get-cell ~cache-sym)
(catch ClassCastException e# (catch ClassCastException e#
;; With AOT compilation it's possible for:
;; Thread 1: unbound, so throw exception
;; Thread 2: unbound, so throw exception
;; Thread 1: do alter-var-root
;; Thread 2: it's bound, so retrieve the current value
(if (bound? (var ~cache-sym)) (if (bound? (var ~cache-sym))
(throw e#) (i/get-cell ~cache-sym)
(do (do
(alter-var-root (alter-var-root
(var ~cache-sym) (var ~cache-sym)