summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-10-16 15:28:02 -0400
committerBen Gamari <ben@smart-cactus.org>2017-10-16 17:24:49 -0400
commit7e790b38c205da67681f632b00faf7a0ea33510d (patch)
treec23e0efca6d007dc2120d951a291e45bf08c7fa8
parent5dab54428229a8d4f1658c4ad94f616b211851fe (diff)
downloadhaskell-7e790b38c205da67681f632b00faf7a0ea33510d.tar.gz
rts: Label all threads created by the RTS
Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: pacak, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4068
-rw-r--r--rts/Sparks.c3
-rw-r--r--rts/Weak.c3
-rw-r--r--rts/posix/Signals.c17
-rw-r--r--rts/win32/ConsoleHandler.c14
4 files changed, 23 insertions, 14 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c
index ecd3c38a17..a31a5dfbe5 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -14,6 +14,7 @@
#include "Trace.h"
#include "Prelude.h"
#include "Sparks.h"
+#include "ThreadLabels.h"
#include "sm/HeapAlloc.h"
#if defined(THREADED_RTS)
@@ -43,7 +44,7 @@ createSparkThread (Capability *cap)
tso = createIOThread (cap, RtsFlags.GcFlags.initialStkSize,
(StgClosure *)runSparks_closure);
-
+ labelThread(cap, tso, "spark evaluator");
traceEventCreateSparkThread(cap, tso->id);
appendToRunQueue(cap,tso);
diff --git a/rts/Weak.c b/rts/Weak.c
index f3e91fb31b..577d1cd7d8 100644
--- a/rts/Weak.c
+++ b/rts/Weak.c
@@ -14,6 +14,7 @@
#include "Weak.h"
#include "Schedule.h"
#include "Prelude.h"
+#include "ThreadLabels.h"
#include "Trace.h"
void
@@ -151,5 +152,7 @@ scheduleFinalizers(Capability *cap, StgWeak *list)
rts_mkInt(cap,n)),
(StgClosure *)arr)
);
+
scheduleThread(cap,t);
+ labelThread(cap, t, "weak finalizer thread");
}
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c
index e75f99def8..cf45019d95 100644
--- a/rts/posix/Signals.c
+++ b/rts/posix/Signals.c
@@ -16,6 +16,7 @@
#include "Prelude.h"
#include "Ticker.h"
#include "Stable.h"
+#include "ThreadLabels.h"
#include "Libdw.h"
#if defined(alpha_HOST_ARCH)
@@ -471,14 +472,16 @@ startSignalHandlers(Capability *cap)
// freed by runHandler
memcpy(info, next_pending_handler, sizeof(siginfo_t));
- scheduleThread(cap,
+ StgTSO *t =
createIOThread(cap,
- RtsFlags.GcFlags.initialStkSize,
- rts_apply(cap,
- rts_apply(cap,
- &base_GHCziConcziSignal_runHandlersPtr_closure,
- rts_mkPtr(cap, info)),
- rts_mkInt(cap, info->si_signo))));
+ RtsFlags.GcFlags.initialStkSize,
+ rts_apply(cap,
+ rts_apply(cap,
+ &base_GHCziConcziSignal_runHandlersPtr_closure,
+ rts_mkPtr(cap, info)),
+ rts_mkInt(cap, info->si_signo)));
+ scheduleThread(cap, t);
+ labelThread(cap, t, "signal handler thread");
}
unblockUserSignals();
diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c
index 3d283b0162..88c4a61912 100644
--- a/rts/win32/ConsoleHandler.c
+++ b/rts/win32/ConsoleHandler.c
@@ -183,13 +183,15 @@ void startSignalHandlers(Capability *cap)
handler = deRefStablePtr((StgStablePtr)console_handler);
while (stg_pending_events > 0) {
stg_pending_events--;
- scheduleThread(cap,
+ StgTSO *t =
createIOThread(cap,
- RtsFlags.GcFlags.initialStkSize,
- rts_apply(cap,
- (StgClosure *)handler,
- rts_mkInt(cap,
- stg_pending_buf[stg_pending_events]))));
+ RtsFlags.GcFlags.initialStkSize,
+ rts_apply(cap,
+ (StgClosure *)handler,
+ rts_mkInt(cap,
+ stg_pending_buf[stg_pending_events])));
+ scheduleThread(cap, t);
+ labelThread(cap, t, "signal handler thread");
}
RELEASE_LOCK(&sched_mutex);