packages feed

Etage 0.1.11 → 0.1.12

raw patch · 3 files changed

+14/−13 lines, 3 filesdep +SafeSemaphorePVP ok

version bump matches the API change (PVP)

Dependencies added: SafeSemaphore

API changes (from Hackage documentation)

Files

Etage.cabal view
@@ -1,5 +1,5 @@ Name:                Etage-Version:             0.1.11+Version:             0.1.12 Synopsis:            A general data-flow framework Description:         A general data-flow framework featuring nondeterminism, laziness and neurological pseudo-terminology. It can be                      used for example for data-flow computations or event propagation networks. It tries hard to aide type checking and to@@ -20,7 +20,7 @@ License-file:        LICENSE Author:              Mitar Milutinovic Maintainer:          mitar.haskell@tnode.com-Copyright:           (c) 2010-2013 Mitar Milutinovic+Copyright:           (c) 2010-2014 Mitar Milutinovic Category:            Control, AI Build-type:          Simple Cabal-version:       >= 1.8@@ -43,6 +43,7 @@                        time >= 1.1 && < 2,                        operational >= 0.2 && < 1,                        containers >= 0.4 && < 1,+                       SafeSemaphore >= 0.10 && < 1,                        ghc >= 7   Other-modules:       Control.Etage.Internals,                        Control.Etage.Externals,
lib/Control/Etage/Externals.hs view
@@ -74,16 +74,17 @@   impulseCompare ) where -import Prelude hiding (catch)+import Prelude  import Control.Concurrent hiding (Chan, writeChan, readChan, isEmptyChan, getChanContents)+import Control.Concurrent.MSampleVar import Data.Data import Data.Function import Data.List import Control.Exception import Data.Time.Clock.POSIX import GHC.IO (unsafeUnmask)-import GHC.Conc (forkOnIO, numCapabilities)+import GHC.Conc (numCapabilities) import System.IO import System.Posix.Signals import System.Random@@ -245,11 +246,9 @@ divideNeuron options a = fork a   where fork = case getNeuronMapCapability options of                  NeuronFreelyMapOnCapability -> forkIO-                 NeuronMapOnCapability c     -> forkOnIO c+                 NeuronMapOnCapability c     -> forkOn c --- TODO: Use "deriving instance Typeable1 NeuronOptions" once support for that is in stable GHC version-instance Typeable1 NeuronOptions where-  typeOf1 _ = mkTyConApp (mkTyCon "Control.Etage.Externals.NeuronOptions") []+deriving instance Typeable1 NeuronOptions  {-| An existentially quantified type encompassing all 'Impulse's. Useful when 'Neuron' should send or receive any 'Impulse' type.@@ -397,7 +396,7 @@ attach' :: Neuron n => (NeuronOptions n -> NeuronOptions n) -> Nerve (NeuronFromImpulse n) fromConductivity (NeuronForImpulse n) forConductivity -> IO LiveNeuron attach' optionsSetter nerve = mask_ $ do   currentThread <- myThreadId-  dissolved <- newEmptySampleVar+  dissolved <- newEmptySV   defOptions <- mkDefaultOptions   let options = optionsSetter defOptions   nid <- divideNeuron options $@@ -406,7 +405,7 @@                Handler (\(_ :: DissolveException) -> return ()), -- we ignore DissolveException                Handler (\(e :: BlockedIndefinitelyOnMVar) -> hPutStrLn stderr $ "Warning: " ++ show e ++ ". Have you forgot to initialize with prepareEnvironment?"), -- we ignore BlockedIndefinitelyOnMVar                Handler (\(e :: SomeException) -> uninterruptible $ throwTo currentThread e)-             ] `finally` uninterruptible (writeSampleVar dissolved ())+             ] `finally` uninterruptible (writeSV dissolved ())   return $ LiveNeuron dissolved nid  {-|@@ -458,7 +457,7 @@ detachManyAndWait :: [LiveNeuron] -> IO () detachManyAndWait neurons = mask_ $ do   detachMany neurons-  mapM_ (\(LiveNeuron d _) -> uninterruptible $ readSampleVar d) neurons+  mapM_ (\(LiveNeuron d _) -> uninterruptible $ readSV d) neurons  -- Some IO operations are interruptible, better than to make them uninterruptible (which can cause deadlocks) we simply retry interrupted operation -- For this to really work all interruptible operations should be wrapped like this (so it is not good idea to use IO operations in such code sections)
lib/Control/Etage/Internals.hs view
@@ -23,6 +23,7 @@  import Control.Applicative import Control.Concurrent hiding (Chan, newChan)+import Control.Concurrent.MSampleVar import Data.Data import Data.Time.Clock.POSIX import Numeric@@ -126,11 +127,11 @@ data BothNerve where   BothNerve :: (Impulse from, Impulse for) => Nerve from AxonConductive for AxonConductive -> BothNerve -type NeuronDissolved = SampleVar ()+type NeuronDissolved = MSampleVar () type NeuronId = ThreadId  #if !(MIN_VERSION_base(4,4,0))-deriving instance Typeable1 SampleVar+deriving instance Typeable1 MSampleVar #endif  instance Show NeuronDissolved where