summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2020-11-02 13:53:28 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-13 14:30:16 -0500
commitde7ec9dd2bd573d5950ae294747d2bdb45051000 (patch)
tree3a054a6b5bd6b8a467ac4605fae40b8d6c42efa6 /includes
parent197d59facbe8f9799df47e86c99f401ced487040 (diff)
downloadhaskell-de7ec9dd2bd573d5950ae294747d2bdb45051000.tar.gz
Add rts_listThreads and rts_listMiscRoots to RtsAPI.h
These are used to find the current roots of the garbage collector. Co-authored-by: Sven Tennie's avatarSven Tennie <sven.tennie@gmail.com> Co-authored-by: Matthew Pickering's avatarMatthew Pickering <matthewtpickering@gmail.com> Co-authored-by: default avatarBen Gamari <bgamari.foss@gmail.com>
Diffstat (limited to 'includes')
-rw-r--r--includes/RtsAPI.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 6c782e504a..36ab4d4b04 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -17,8 +17,10 @@ extern "C" {
#include "HsFFI.h"
#include "rts/Time.h"
+#include "rts/Types.h"
#include "rts/EventLogWriter.h"
+
/*
* Running the scheduler
*/
@@ -566,6 +568,16 @@ void rts_resume (PauseToken *pauseToken);
// Returns true if the rts is paused. See rts_pause() and rts_resume().
bool rts_isPaused(void);
+// List all live threads. The RTS must be paused and this must be called on the
+// same thread that called rts_pause().
+typedef void (*ListThreadsCb)(void *user, StgTSO *);
+void rts_listThreads(ListThreadsCb cb, void *user);
+
+// List all non-thread GC roots. The RTS must be paused and this must be called
+// on the same thread that called rts_pause().
+typedef void (*ListRootsCb)(void *user, StgClosure *);
+void rts_listMiscRoots(ListRootsCb cb, void *user);
+
/*
* The RTS allocates some thread-local data when you make a call into
* Haskell using one of the rts_eval() functions. This data is not