summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-04-12 11:21:41 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-04-12 13:40:53 +0100
commit392c2886dcd14e4aa57440b8169ba427f5a93c8b (patch)
treeaedcbf84b23629fe8ec40819d0532e5974651ffd
parent206c8fc3ebd64c40ae09742fdea09ffd0f915d5c (diff)
downloadhaskell-392c2886dcd14e4aa57440b8169ba427f5a93c8b.tar.gz
updateThunk: minor tweak to avoid an unnecessary call to checkBlockingQueues
-rw-r--r--rts/Threads.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/rts/Threads.c b/rts/Threads.c
index 802a37c94c..997bcc8882 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -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;
}