+{-# LANGUAGE CPP #-}
+#ifdef __GLASGOW_HASKELL__
+{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
+#endif
+
-----------------------------------------------------------------------------
-- |
-- Module : Control.Concurrent.SampleVar
import Data.Functor ( (<$>) )
+import Data.Typeable
+
+#include "Typeable.h"
+
-- |
-- Sample variables are slightly different from a normal 'MVar':
--
)
deriving (Eq)
+INSTANCE_TYPEABLE1(SampleVar,sampleVarTc,"SampleVar")
+
-- |Build a new, empty, 'SampleVar'
newEmptySampleVar :: IO (SampleVar a)
newEmptySampleVar = do
isEmptySampleVar :: SampleVar a -> IO Bool
isEmptySampleVar (SampleVar svar) = do
(readers, _) <- readMVar svar
- return (readers == 0)
+ return (readers <= 0)