summaryrefslogtreecommitdiff
path: root/includes/RtsAPI.h
diff options
context:
space:
mode:
authorTobias Guggenmos <tguggenm@redhat.com>2019-09-08 14:45:08 +0200
committerTobias Guggenmos <tguggenm@redhat.com>2019-09-08 22:34:29 +0200
commit718e7011e08deffa915629f6f2f07767817d5813 (patch)
tree5804062e9be8fb0619c59bf56b7b3c1b99ef06a3 /includes/RtsAPI.h
parent6ad6303b9fa6190c495fc43fbbb4243b63d4383a (diff)
downloadhaskell-wip/ghc-debug-sched.tar.gz
Add api to pause single threaded RTSwip/ghc-debug-sched
Improve Implementation of pausing the single threaded RTS Stop abusing mutexes
Diffstat (limited to 'includes/RtsAPI.h')
-rw-r--r--includes/RtsAPI.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 6ab7116a7c..1812e53551 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -20,6 +20,7 @@ extern "C" {
#include "rts/Time.h"
#include "rts/Task.h"
#include "rts/EventLogWriter.h"
+#include "rts/OSThreads.h"
/*
* Running the scheduler
@@ -453,8 +454,19 @@ typedef struct RtsPaused_ {
Capability *capabilities;
} RtsPaused;
-RtsPaused rts_pause (void);
-void rts_unpause (RtsPaused paused);
+
+#if !defined(THREADED_RTS)
+struct{
+ // Number of debuggers that want rts to pause
+ size_t pauseRequests;
+ enum {RUNNING, PAUSING, PAUSED, STARTING} state;
+ Mutex pauseLock;
+ Condition stateChange;
+} nonThreadedPause;
+#endif
+
+void rts_pause (/* out */ RtsPaused *paused);
+void rts_unpause (/* in */ RtsPaused *paused);
// List all live threads. Must be done while RTS is paused.
typedef void (*ListThreadsCb)(void *user, StgTSO *);