technomancy / robert-hooke

Hooke your Clojure functions!
Other
358 stars 27 forks source link

Fix race condition hooking a var from two threads #22

Open grammati opened 8 years ago

grammati commented 8 years ago

It was possible for two threads to interleave their execution in such a way that the map of hooks in the ::hooks metadata would be missing one of the hooks.

This commit adds a second check of whether the ::hooks key has already been added, this time inside alter-var-root's lock.