updateThunk: minor tweak to avoid an unnecessary call to checkBlockingQueues
authorSimon Marlow <marlowsd@gmail.com>
Thu, 12 Apr 2012 10:21:41 +0000 (11:21 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 12 Apr 2012 12:40:53 +0000 (13:40 +0100)
rts/Threads.c

index 802a37c..997bcc8 100644 (file)
@@ -424,12 +424,16 @@ updateThunk (Capability *cap, StgTSO *tso, StgClosure *thunk, StgClosure *val)
 
     updateWithIndirection(cap, thunk, val);
 
+    // sometimes the TSO is locked when we reach here, so its header
+    // might be WHITEHOLE.  Hence check for the correct owner using
+    // pointer equality first.
+    if ((StgTSO*)v == tso) {
+        return;
+    }
+
     i = v->header.info;
     if (i == &stg_TSO_info) {
-        owner = (StgTSO*)v;
-        if (owner != tso) {
-            checkBlockingQueues(cap, tso);
-        }
+        checkBlockingQueues(cap, tso);
         return;
     }