Skip to content

Commit

Permalink
fix(core/event_dispatcher): cache concurrent calls
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunk committed Feb 13, 2024
1 parent ba655a0 commit 08c9d46
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ class EventDispatcher(
context.mappings.useMapper(ViewBinderMapper::class) {
val cachedHooks = mutableListOf<String>()
fun cacheHook(clazz: Class<*>, block: Class<*>.() -> Unit) {
if (!cachedHooks.contains(clazz.name)) {
clazz.block()
cachedHooks.add(clazz.name)
synchronized(cachedHooks) {
if (!cachedHooks.contains(clazz.name)) {
clazz.block()
cachedHooks.add(clazz.name)
}
}
}

Expand Down

0 comments on commit 08c9d46

Please sign in to comment.