summaryrefslogtreecommitdiff
path: root/rts/PrimOps.cmm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-10-26 13:08:39 -0400
committerBen Gamari <ben@smart-cactus.org>2022-08-06 11:48:50 -0400
commitaa818a9f83308d0742e8f8c91cb9878182dacce5 (patch)
tree48089b58289212cfdaef065ad7cc21b77c8beaaa /rts/PrimOps.cmm
parent7267cd52fb0b06479b9ceea2dc4700d949a1d75b (diff)
downloadhaskell-aa818a9f83308d0742e8f8c91cb9878182dacce5.tar.gz
Add primop to list threads
A user came to #ghc yesterday wondering how best to check whether they were leaking threads. We ended up using the eventlog but it seems to me like it would be generally useful if Haskell programs could query their own threads.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r--rts/PrimOps.cmm8
1 files changed, 8 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 7b760e5702..503797f556 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -1081,6 +1081,14 @@ stg_labelThreadzh ( gcptr threadid, W_ addr )
return ();
}
+stg_listThreadszh ()
+{
+ P_ arr;
+
+ ("ptr" arr) = ccall listThreads(MyCapability() "ptr");
+ return (arr);
+}
+
stg_isCurrentThreadBoundzh (/* no args */)
{
W_ r;