concurrency 1.6.2.0 → 1.7.0.0
raw patch · 3 files changed
+47/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Conc.Class: supportsBoundThreads :: MonadConc m => m Bool
Files
- CHANGELOG.rst +19/−0
- Control/Monad/Conc/Class.hs +25/−2
- concurrency.cabal +3/−3
CHANGELOG.rst view
@@ -7,6 +7,25 @@ .. _PVP: https://pvp.haskell.org/ +1.7.0.0 (2019-03-24)+--------------------++* Git: :tag:`concurrency-1.7.0.0`+* Hackage: :hackage:`concurrency-1.7.0.0`++Added+~~~~~++* The ``Control.Monad.Conc.Class.supportsBoundThreads`` function, like+ ``rtsSupportsBoundThreads`` but returns a monadic result.++Deprecated+~~~~~~~~~~++* ``Control.Monad.Conc.Class.rtsSupportsBoundThreads``, in favour of+ ``supportsBoundThreads``.++ 1.6.2.0 (2018-11-28) --------------------
Control/Monad/Conc/Class.hs view
@@ -55,7 +55,7 @@ -- To a foreign library, the bound thread will look exactly like an -- ordinary operating system thread created using OS functions like -- pthread_create or CreateThread.- , IO.rtsSupportsBoundThreads+ , rtsSupportsBoundThreads , runInBoundThread , runInUnboundThread @@ -150,7 +150,7 @@ -- Do not be put off by the use of @UndecidableInstances@, it is safe -- here. ----- @since 1.6.0.0+-- @since 1.7.0.0 class ( Monad m , MonadCatch m, MonadThrow m, MonadMask m , MonadSTM (STM m)@@ -160,6 +160,7 @@ (forkWithUnmask | forkWithUnmaskN) , (forkOnWithUnmask | forkOnWithUnmaskN) , (forkOSWithUnmask | forkOSWithUnmaskN)+ , supportsBoundThreads , isCurrentThreadBound , getNumCapabilities , setNumCapabilities@@ -271,6 +272,13 @@ forkOSWithUnmaskN :: String -> ((forall a. m a -> m a) -> m ()) -> m (ThreadId m) forkOSWithUnmaskN _ = forkOSWithUnmask + -- | Returns 'True' if bound threads can be forked. If 'False',+ -- 'isCurrentThreadBound' will always return 'False' and both+ -- 'forkOS' and 'runInBoundThread' will fail.+ --+ -- @since 1.7.0.0+ supportsBoundThreads :: m Bool+ -- | Returns 'True' if the calling thread is bound, that is, if it -- is safe to use foreign libraries that rely on thread-local state -- from the calling thread.@@ -560,6 +568,18 @@ forkOSN :: MonadConc m => String -> m () -> m (ThreadId m) forkOSN name ma = forkOSWithUnmaskN name (const ma) +-- | 'True' if bound threads are supported. If+-- 'rtsSupportsBoundThreads' is 'False', 'isCurrentThreadBound' will+-- always return 'False' and both 'forkOS' and 'runInBoundThread' will+-- fail.+--+-- Use 'supportsBoundThreads' in 'MonadConc' instead.+--+-- @since 1.3.0.0+{-# DEPRECATED rtsSupportsBoundThreads "Use 'supportsBoundThreads' instead" #-}+rtsSupportsBoundThreads :: Bool+rtsSupportsBoundThreads = IO.rtsSupportsBoundThreads+ -- | Run the computation passed as the first argument. If the calling -- thread is not /bound/, a bound thread is created temporarily. -- @runInBoundThread@ doesn't finish until the inner computation@@ -726,6 +746,7 @@ labelMe n ma umask + supportsBoundThreads = pure IO.rtsSupportsBoundThreads isCurrentThreadBound = IO.isCurrentThreadBound getNumCapabilities = IO.getNumCapabilities@@ -797,6 +818,7 @@ forkOSWithUnmask ma = toIsConc (forkOSWithUnmask (\umask -> unIsConc $ ma (\mx -> toIsConc (umask $ unIsConc mx)))) forkOSWithUnmaskN n ma = toIsConc (forkOSWithUnmaskN n (\umask -> unIsConc $ ma (\mx -> toIsConc (umask $ unIsConc mx)))) + supportsBoundThreads = toIsConc supportsBoundThreads isCurrentThreadBound = toIsConc isCurrentThreadBound getNumCapabilities = toIsConc getNumCapabilities@@ -845,6 +867,7 @@ forkOSWithUnmask = liftedFork F forkOSWithUnmask ; \ forkOSWithUnmaskN n = liftedFork F (forkOSWithUnmaskN n ) ; \ \+ supportsBoundThreads = lift supportsBoundThreads ; \ isCurrentThreadBound = lift isCurrentThreadBound ; \ \ getNumCapabilities = lift getNumCapabilities ; \
concurrency.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: concurrency-version: 1.6.2.0+version: 1.7.0.0 synopsis: Typeclasses, functions, and data types for concurrency and STM. description:@@ -19,7 +19,7 @@ license-file: LICENSE author: Michael Walker maintainer: mike@barrucadu.co.uk-copyright: (c) 2016--2017 Michael Walker+copyright: (c) 2016--2019 Michael Walker category: Concurrency build-type: Simple extra-source-files: README.markdown CHANGELOG.rst@@ -32,7 +32,7 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: concurrency-1.6.2.0+ tag: concurrency-1.7.0.0 library exposed-modules: Control.Monad.Conc.Class