summaryrefslogtreecommitdiff
path: root/rts/SMPClosureOps.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2018-07-12 10:13:47 -0400
committerBen Gamari <ben@smart-cactus.org>2018-07-12 15:04:20 -0400
commit7fc418df856d9b58034eeec48915646e67a7a562 (patch)
tree656a7a8ae131122c4253bb6c490fb9e7db671346 /rts/SMPClosureOps.h
parent1a79270c72cfcd98d683cfe7b2c777d8dd353b78 (diff)
downloadhaskell-7fc418df856d9b58034eeec48915646e67a7a562.tar.gz
Fix deadlock between STM and throwTo
There was a lock-order reversal between lockTSO() and the TVar lock, see #15136 for the details. It turns out we can fix this pretty easily by just deleting all the locking code(!). The principle for unblocking a `BlockedOnSTM` thread then becomes the same as for other kinds of blocking: if the TSO belongs to this capability then we do it directly, otherwise we send a message to the capability that owns the TSO. That is, a thread blocked on STM is owned by its capability, as it should be. The possible downside of this is that we might send multiple messages to wake up a thread when the thread is on another capability. This is safe, it's just not very efficient. I'll try to do some experiments to see if this is a problem. Test Plan: Test case from #15136 doesn't deadlock any more. Reviewers: bgamari, osa1, erikd Reviewed By: osa1 Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15136 Differential Revision: https://phabricator.haskell.org/D4956
Diffstat (limited to 'rts/SMPClosureOps.h')
-rw-r--r--rts/SMPClosureOps.h9
1 files changed, 0 insertions, 9 deletions
diff --git a/rts/SMPClosureOps.h b/rts/SMPClosureOps.h
index 1d18e1b018..c73821a782 100644
--- a/rts/SMPClosureOps.h
+++ b/rts/SMPClosureOps.h
@@ -124,15 +124,6 @@ EXTERN_INLINE void unlockClosure(StgClosure *p, const StgInfoTable *info)
p->header.info = info;
}
-// Handy specialised versions of lockClosure()/unlockClosure()
-INLINE_HEADER void lockTSO(StgTSO *tso);
-INLINE_HEADER void lockTSO(StgTSO *tso)
-{ lockClosure((StgClosure *)tso); }
-
-INLINE_HEADER void unlockTSO(StgTSO *tso);
-INLINE_HEADER void unlockTSO(StgTSO *tso)
-{ unlockClosure((StgClosure*)tso, (const StgInfoTable *)&stg_TSO_info); }
-
#endif /* CMINUSMINUS */
#include "EndPrivate.h"