diff options
author | Simon Marlow <marlowsd@gmail.com> | 2014-09-26 20:08:43 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2014-11-28 14:10:32 +0000 |
commit | b5e8b3b162b3ff15ae6caf1afc659565365f54a8 (patch) | |
tree | 87e99c82b570a80340c624c88b6232747e4b66f4 /rts/CheckUnload.c | |
parent | 58dcd5c2e2a94643454296ea0bb109db96bd154f (diff) | |
download | haskell-b5e8b3b162b3ff15ae6caf1afc659565365f54a8.tar.gz |
Make the linker API thread-safe
We used to be able to rely on the client to use the API in a
single-threaded way, but now that the GC calls into the linker to
unload objects this isn't a safe assumption.
Diffstat (limited to 'rts/CheckUnload.c')
-rw-r--r-- | rts/CheckUnload.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index c63a35a24e..73573fbb34 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -260,6 +260,8 @@ void checkUnload (StgClosure *static_objects) if (unloaded_objects == NULL) return; + ACQUIRE_LOCK(&linker_mutex); + // Mark every unloadable object as unreferenced initially for (oc = unloaded_objects; oc; oc = oc->next) { IF_DEBUG(linker, debugBelch("Checking whether to unload %" PATH_FMT "\n", @@ -317,4 +319,6 @@ void checkUnload (StgClosure *static_objects) } freeHashTable(addrs, NULL); + + RELEASE_LOCK(&linker_mutex); } |