From: Ian Lynagh Date: Sun, 3 Aug 2008 14:17:03 +0000 (+0000) Subject: Remove the duplicate definition of throwTo in Control.Exception X-Git-Tag: 6_10_branch_has_been_forked~96 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e42428e03dbfded183af608e58604b29ce26cfb8;p=ghc-base.git Remove the duplicate definition of throwTo in Control.Exception It now imports GHC.Conc, so it is no longer necessary --- diff --git a/Control/Exception.hs b/Control/Exception.hs index 8d5aa2d..e923d90 100644 --- a/Control/Exception.hs +++ b/Control/Exception.hs @@ -130,7 +130,7 @@ import GHC.List import GHC.Show import GHC.IOBase as ExceptionBase import GHC.Exception hiding ( Exception ) -import GHC.Conc ( ThreadId(ThreadId) ) +import GHC.Conc #endif #ifdef __HUGS__ @@ -588,10 +588,3 @@ nestedAtomically = toException NestedAtomically instance Exception Dynamic ------ - --- XXX From GHC.Conc -throwTo :: Exception e => ThreadId -> e -> IO () -throwTo (ThreadId id) ex = IO $ \ s -> - case (killThread# id (toException ex) s) of s1 -> (# s1, () #) - diff --git a/GHC/Conc.lhs b/GHC/Conc.lhs index d47ba0b..6ae157e 100644 --- a/GHC/Conc.lhs +++ b/GHC/Conc.lhs @@ -263,11 +263,11 @@ The memory used by the thread will be garbage collected if it isn\'t referenced from anywhere. The 'killThread' function is defined in terms of 'throwTo': -> killThread tid = throwTo tid (AsyncException ThreadKilled) +> killThread tid = throwTo tid ThreadKilled -} killThread :: ThreadId -> IO () -killThread tid = throwTo tid (toException ThreadKilled) +killThread tid = throwTo tid ThreadKilled {- | 'throwTo' raises an arbitrary exception in the target thread (GHC only). @@ -299,10 +299,9 @@ unblock and then re-block exceptions (using 'unblock' and 'block') without recei a pending 'throwTo'. This is arguably undesirable behaviour. -} --- XXX This is duplicated in Control.{Old,}Exception -throwTo :: ThreadId -> SomeException -> IO () +throwTo :: Exception e => ThreadId -> e -> IO () throwTo (ThreadId id) ex = IO $ \ s -> - case (killThread# id ex s) of s1 -> (# s1, () #) + case (killThread# id (toException ex) s) of s1 -> (# s1, () #) -- | Returns the 'ThreadId' of the calling thread (GHC only). myThreadId :: IO ThreadId