Thu Jul 10 08:17:11 PDT 2008 Simon Marlow <[EMAIL PROTECTED]>
* Add threadStatus :: ThreadId -> IO ThreadStatus
-- | The current status of a thread
data ThreadStatus
= ThreadRunning
-- ^the thread is currently runnable or running
| ThreadFinished
-- ^the thread has finished
| ThreadBlocked BlockReason
-- ^the thread is blocked on some resource
| ThreadDied
-- ^the thread received an uncaught exception
deriving (Eq,Ord,Show)
data BlockReason
= BlockedOnMVar
-- ^blocked on on 'MVar'
| BlockedOnBlackHole
-- ^blocked on a computation in progress by another thread
| BlockedOnException
-- ^blocked in 'throwTo'
| BlockedOnSTM
-- ^blocked in 'retry' in an STM transaction
| BlockedOnForeignCall
-- ^currently in a foreign call
| BlockedOnOther
-- ^blocked on some other resource. Without @-threaded@,
-- I/O and 'threadDelay' show up as 'BlockedOnOther', with @-threaded@
-- they show up as 'BlockedOnMVar'.
deriving (Eq,Ord,Show)
This is useful for concurrency debugging. I've left threadStatus in
GHC.Conc for now, since the ThreadStatus type is somewhat GHC-specific.
M ./GHC/Conc.lhs +50
View patch online:
http://darcs.haskell.org/packages/base/_darcs/patches/20080710151711-12142-3744e5cb087f2be8ed4b6e2da0f879da4712ec9b.gz
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries