packages feed

threads 0.5 → 0.5.0.1

raw patch · 4 files changed

+47/−18 lines, 4 filesdep ~basedep ~stmdep ~test-framework

Dependency ranges changed: base, stm, test-framework

Files

+ Control/Concurrent/Raw.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude, MagicHash, UnboxedTuples #-}++module Control.Concurrent.Raw ( rawForkIO, rawForkOn ) where++import Data.Function ( ($) )+import GHC.IO        ( IO(IO) )+import GHC.Exts      ( Int(I#), fork#, forkOn# )+import GHC.Conc      ( ThreadId(ThreadId) )++-- A version of forkIO that does not include the outer exception+-- handler: saves a bit of time when we will be installing our own+-- exception handler.+{-# INLINE rawForkIO #-}+rawForkIO ∷ IO () → IO ThreadId+rawForkIO action = IO $ \s →+   case (fork# action s) of (# s1, tid #) → (# s1, ThreadId tid #)++{-# INLINE rawForkOn #-}+rawForkOn ∷ Int → IO () → IO ThreadId+rawForkOn (I# cpu) action = IO $ \s →+   case (forkOn# cpu action s) of (# s1, tid #) → (# s1, ThreadId tid #)
Control/Concurrent/Thread.hs view
@@ -1,5 +1,9 @@-{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax, RankNTypes #-}+{-# LANGUAGE CPP, NoImplicitPrelude, UnicodeSyntax, RankNTypes #-} +#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif+ -------------------------------------------------------------------------------- -- | -- Module     : Control.Concurrent.Thread@@ -52,9 +56,7 @@ --------------------------------------------------------------------------------  -- from base:-import qualified Control.Concurrent ( forkIO-                                    , forkOS-                                    , forkOn+import qualified Control.Concurrent ( forkOS                                     , forkIOWithUnmask                                     , forkOnWithUnmask                                     )@@ -70,7 +72,10 @@ -- from base-unicode-symbols: import Data.Function.Unicode        ( (∘) ) +-- from threads:+import Control.Concurrent.Raw       ( rawForkIO, rawForkOn ) + -------------------------------------------------------------------------------- -- * Forking threads --------------------------------------------------------------------------------@@ -79,7 +84,7 @@ -- a computation that when executed blocks until the thread terminates -- then returns the final value of the thread. forkIO ∷ IO α → IO (ThreadId, IO (Result α))-forkIO = fork Control.Concurrent.forkIO+forkIO = fork rawForkIO  -- | Like @Control.Concurrent.'Control.Concurrent.forkOS'@ but returns -- a computation that when executed blocks until the thread terminates@@ -91,7 +96,7 @@ -- a computation that when executed blocks until the thread terminates -- then returns the final value of the thread. forkOn ∷ Int → IO α → IO (ThreadId, IO (Result α))-forkOn = fork ∘ Control.Concurrent.forkOn+forkOn = fork ∘ rawForkOn  -- | Like @Control.Concurrent.'Control.Concurrent.forkIOWithUnmask'@ but returns -- a computation that when executed blocks until the thread terminates
Control/Concurrent/Thread/Group.hs view
@@ -5,6 +5,10 @@            , RankNTypes   #-} +#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif+ -------------------------------------------------------------------------------- -- | -- Module     : Control.Concurrent.Thread.Group@@ -47,9 +51,7 @@ --------------------------------------------------------------------------------  -- from base:-import qualified Control.Concurrent     ( forkIO-                                        , forkOS-                                        , forkOn+import qualified Control.Concurrent     ( forkOS                                         , forkIOWithUnmask                                         , forkOnWithUnmask                                         )@@ -75,7 +77,7 @@  -- from threads: import Control.Concurrent.Thread        ( Result )-+import Control.Concurrent.Raw           ( rawForkIO, rawForkOn ) #ifdef __HADDOCK__ import qualified Control.Concurrent.Thread as Thread ( forkIO                                                      , forkOS@@ -134,7 +136,7 @@ -- | Same as @Control.Concurrent.Thread.'Thread.forkIO'@ but additionaly adds -- the thread to the group. forkIO ∷ ThreadGroup → IO α → IO (ThreadId, IO (Result α))-forkIO = fork Control.Concurrent.forkIO+forkIO = fork rawForkIO  -- | Same as @Control.Concurrent.Thread.'Thread.forkOS'@ but additionaly adds -- the thread to the group.@@ -144,7 +146,7 @@ -- | Same as @Control.Concurrent.Thread.'Thread.forkOn'@ but -- additionaly adds the thread to the group. forkOn ∷ Int → ThreadGroup → IO α → IO (ThreadId, IO (Result α))-forkOn = fork ∘ Control.Concurrent.forkOn+forkOn = fork ∘ rawForkOn  -- | Same as @Control.Concurrent.Thread.'Thread.forkIOWithUnmask'@ but -- additionaly adds the thread to the group.
threads.cabal view
@@ -1,5 +1,5 @@ name:          threads-version:       0.5+version:       0.5.0.1 cabal-version: >= 1.9.2 build-type:    Custom stability:     experimental@@ -45,11 +45,12 @@ -------------------------------------------------------------------------------  library-  build-depends: base                 >= 4.4   && < 4.6+  build-depends: base                 >= 4.4   && < 4.7                , base-unicode-symbols >= 0.1.1 && < 0.3-               , stm                  >= 2.1   && < 2.4+               , stm                  >= 2.1   && < 2.5   exposed-modules: Control.Concurrent.Thread                  , Control.Concurrent.Thread.Group+  other-modules:   Control.Concurrent.Raw   ghc-options: -Wall  -------------------------------------------------------------------------------@@ -61,10 +62,10 @@   ghc-options:    -Wall -threaded    build-depends: threads-               , base                 >= 4.4   && < 4.6+               , base                 >= 4.4   && < 4.7                , base-unicode-symbols >= 0.1.1 && < 0.3-               , stm                  >= 2.1   && < 2.4+               , stm                  >= 2.1   && < 2.5                , concurrent-extra     >= 0.5.1 && < 0.8                , HUnit                >= 1.2.2 && < 1.3-               , test-framework       >= 0.2.4 && < 0.6+               , test-framework       >= 0.2.4 && < 0.7                , test-framework-hunit >= 0.2.4 && < 0.3