We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abe23d2 commit b52bdc0Copy full SHA for b52bdc0
src/copyable_task.jl
@@ -113,6 +113,17 @@ struct CacheKey
113
key::Any
114
end
115
116
+"""
117
+ GlobalMCCache
118
+
119
+A cache for holding MistyClosures, keyed by CacheKey.
120
121
+The reason to have a type for this, rather than just a global const
122
+Dict{CacheKey,MistyClosure}, is thread-safety. The global cache is written to when new
123
+TapedTasks are compiled, and if multiple threads are doing this concurrently races might
124
+occur. This type uses a ReentrantLock to ensure that any `setindex!` operations are atomic,
125
+solving the problem.
126
127
struct GlobalMCCache
128
cache::Dict{CacheKey,MistyClosure}
129
lock::ReentrantLock
0 commit comments