Commit 40b1a3cb authored by Simon Marlow's avatar Simon Marlow

add locking in mkWeakForeignEnv#

parent 4caf3550
...@@ -377,8 +377,10 @@ stg_mkWeakForeignEnvzh ...@@ -377,8 +377,10 @@ stg_mkWeakForeignEnvzh
StgWeak_finalizer(w) = stg_NO_FINALIZER_closure; StgWeak_finalizer(w) = stg_NO_FINALIZER_closure;
StgWeak_cfinalizer(w) = p; StgWeak_cfinalizer(w) = p;
ACQUIRE_LOCK(sm_mutex);
StgWeak_link(w) = W_[weak_ptr_list]; StgWeak_link(w) = W_[weak_ptr_list];
W_[weak_ptr_list] = w; W_[weak_ptr_list] = w;
RELEASE_LOCK(sm_mutex);
IF_DEBUG(weak, foreign "C" debugBelch(stg_weak_msg,w) []); IF_DEBUG(weak, foreign "C" debugBelch(stg_weak_msg,w) []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment