Hi,

doc:  
http://www.haskell.org/ghc/docs/7.0-latest/html/libraries/base-4.3.0.0/Control-Concurrent-SampleVar.html
source:  
http://www.haskell.org/ghc/docs/7.0-latest/html/libraries/base-4.3.0.0/src/Control-Concurrent-SampleVar.html

The documentation for Control.Concurrent.SampleVar implies that a
SampleVar is either "filled" or "empty".  The source code suggests
that there are three possible states:  "full" (when readers == 1),
"empty" (when readers == 0), and "empty with blocked readers" (when
readers < 0).  In particular, the isEmptySampleVar function,

isEmptySampleVar :: SampleVar a -> IO Bool
isEmptySampleVar (SampleVar svar) = do
  (readers, _) <- readMVar svar
  return (readers == 0)

returns false in the third state, when readers < 0.  Can someone
clarify the semantics of SampleVar?

Thanks,
Eric

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to