From aa818a9f83308d0742e8f8c91cb9878182dacce5 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 26 Oct 2019 13:08:39 -0400 Subject: 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. --- rts/PrimOps.cmm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rts/PrimOps.cmm') 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; -- cgit v1.2.1