1. Bryan O'Sullivan
  2. pool

Commits

basvandijk  committed 0d8de13

Label the reaper thread

This enables identifying those threads when analyzing a GHC event log
file using ghc-events-analyze.

  • Participants
  • Parent commits dc9e328
  • Branches default

Comments (0)

Files changed (1)

File Data/Pool.hs

View file
 import Data.IORef (IORef, newIORef, mkWeakIORef)
 import Data.List (partition)
 import Data.Time.Clock (NominalDiffTime, UTCTime, diffUTCTime, getCurrentTime)
+import GHC.Conc.Sync (labelThread)
 import qualified Control.Exception as E
 import qualified Data.Vector as V
 
     modError "pool " $ "invalid maximum resource count " ++ show maxResources
   localPools <- V.replicateM numStripes $
                 liftM3 LocalPool (newTVarIO 0) (newTVarIO []) (newIORef ())
-  reaperId <- forkIO $ reaper destroy idleTime localPools
+  reaperId <- forkIO $ do
+                tid <- myThreadId
+                labelThread tid "resource-pool: reaper"
+                reaper destroy idleTime localPools
   fin <- newIORef ()
   let p = Pool {
             create