summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Event
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2014-08-04 08:10:33 -0500
committerAustin Seipp <austin@well-typed.com>2014-08-04 08:10:33 -0500
commitf6866824ce5cdf5359f0cad78c49d65f6d43af12 (patch)
treed6f4c1f81420a2a24aab543cd991fcf74987ea26 /libraries/base/GHC/Event
parent65e5dbcd3971cb3ef5b9073096e5d063034b90c1 (diff)
downloadhaskell-f6866824ce5cdf5359f0cad78c49d65f6d43af12.tar.gz
ghc --make: add nicer names to RTS threads (threaded IO manager, make workers)
Summary: The patch names most of RTS threads and ghc (the tool) threads. It makes nicer debug and eventlog output for ghc itself. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: ran debugged ghc under '+RTS -Ds' Reviewers: simonmar, austin Reviewed By: austin Subscribers: phaskell, simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D101
Diffstat (limited to 'libraries/base/GHC/Event')
-rw-r--r--libraries/base/GHC/Event/Thread.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/libraries/base/GHC/Event/Thread.hs b/libraries/base/GHC/Event/Thread.hs
index 6e991bfb6c..dcfa32aa28 100644
--- a/libraries/base/GHC/Event/Thread.hs
+++ b/libraries/base/GHC/Event/Thread.hs
@@ -39,6 +39,7 @@ import GHC.Event.Manager (Event, EventManager, evtRead, evtWrite, loop,
import qualified GHC.Event.Manager as M
import qualified GHC.Event.TimerManager as TM
import GHC.Num ((-), (+))
+import GHC.Show (showSignedInt)
import System.IO.Unsafe (unsafePerformIO)
import System.Posix.Types (Fd)
@@ -244,11 +245,14 @@ startIOManagerThreads =
forM_ [0..high] (startIOManagerThread eventManagerArray)
writeIORef numEnabledEventManagers (high+1)
+show_int :: Int -> String
+show_int i = showSignedInt 0 i ""
+
restartPollLoop :: EventManager -> Int -> IO ThreadId
restartPollLoop mgr i = do
M.release mgr
!t <- forkOn i $ loop mgr
- labelThread t "IOManager"
+ labelThread t ("IOManager on cap " ++ show_int i)
return t
startIOManagerThread :: IOArray Int (Maybe (ThreadId, EventManager))
@@ -258,7 +262,7 @@ startIOManagerThread eventManagerArray i = do
let create = do
!mgr <- new True
!t <- forkOn i $ loop mgr
- labelThread t "IOManager"
+ labelThread t ("IOManager on cap " ++ show_int i)
writeIOArray eventManagerArray i (Just (t,mgr))
old <- readIOArray eventManagerArray i
case old of