[commit: ghc] master: rts: Label all threads created by the RTS (7e790b3)

git at git.haskell.org git at git.haskell.org
Mon Oct 16 21:26:55 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7e790b38c205da67681f632b00faf7a0ea33510d/ghc

>---------------------------------------------------------------

commit 7e790b38c205da67681f632b00faf7a0ea33510d
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Oct 16 15:28:02 2017 -0400

    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


>---------------------------------------------------------------

7e790b38c205da67681f632b00faf7a0ea33510d
 rts/Sparks.c               |  3 ++-
 rts/Weak.c                 |  3 +++
 rts/posix/Signals.c        | 17 ++++++++++-------
 rts/win32/ConsoleHandler.c | 14 ++++++++------
 4 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/rts/Sparks.c b/rts/Sparks.c
index ecd3c38..a31a5df 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 f3e91fb..577d1cd 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 e75f99d..cf45019 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 3d283b0..88c4a61 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);



More information about the ghc-commits mailing list