pthread 0.1.2 → 0.2.0
raw patch · 3 files changed
+20/−13 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +17/−4
- pthread.cabal +2/−2
- src/System/Posix/Thread.hsc +1/−7
CHANGELOG.md view
@@ -4,13 +4,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). -## [0.1.2] - 2019-06-17+## Unreleased ### Added -* Compatibility with ghc-8.6.-* Bind API for attributes and basic thread operations.-* Check for -threaded.+### Changed++## [0.2.0] - 2017-11-06++### Added++* Bindings for managing threads (create, join, exit, cancel).+* Requirement to link with -threaded if using the new bindings.+* Tests for create, join and exit.+* An exception datatype for the boundness check.++### Changed++* Renamed module to System.Posix.Thread.+* Renamed functions to createKey and deleteKey.+* Show error code on failure. ## [0.1.1] - 2017-09-28
pthread.cabal view
@@ -1,5 +1,5 @@ name: pthread-version: 0.1.2+version: 0.2.0 synopsis: Bindings for the pthread library. homepage: http://github.com/tweag/pthread license: BSD3@@ -25,7 +25,7 @@ exposed-modules: System.Posix.Thread build-depends:- base >= 4.9.0.0 && < 5,+ base > 4.9.0.0 && < 5, generic-deriving >= 1.11 default-language: Haskell2010
src/System/Posix/Thread.hsc view
@@ -40,7 +40,6 @@ import Control.Exception (Exception, bracket_, throwIO) import Control.Monad (forM_, unless, when) import Data.Monoid (First(..))-import Data.Semigroup (Semigroup(..)) import Foreign.C.Types import Foreign.C.Error (Errno(..), errnoToIOError) import Foreign.Marshal.Alloc (alloca)@@ -68,7 +67,6 @@ create :: IO (Ptr a) -> IO ThreadId create action = alloca $ \tidPtr -> do- unless rtsSupportsBoundThreads (error "Use -threaded RTS.") fptr <- wrap $ \_ -> action throwIfNonZero_ $ pthread_create tidPtr nullPtr fptr nullPtr peek tidPtr@@ -90,7 +88,6 @@ createWithAttributes attrs action = alloca $ \tidPtr -> alloca $ \attrsPtr -> do- unless rtsSupportsBoundThreads (error "Use -threaded RTS.") bracket_ (throwIfNonZero_ $ pthread_attr_init attrsPtr) (throwIfNonZero_ $ pthread_attr_destroy attrsPtr) $ do@@ -226,12 +223,9 @@ , stackSize :: First CSize } deriving (Generic, Show) -instance Semigroup AttributesMonoid where- (<>) = mappenddefault- instance Monoid AttributesMonoid where mempty = memptydefault- mappend = (<>)+ mappend = mappenddefault monoidFromAttributes :: Attributes -> AttributesMonoid monoidFromAttributes Attributes{..} =