Skip to content

Commit b52bdc0

Browse files
committed
Add a docstring
1 parent abe23d2 commit b52bdc0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/copyable_task.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ struct CacheKey
113113
key::Any
114114
end
115115

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+
"""
116127
struct GlobalMCCache
117128
cache::Dict{CacheKey,MistyClosure}
118129
lock::ReentrantLock

0 commit comments

Comments
 (0)