diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-02-13 05:34:56 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-02-13 05:34:56 +0100 |
commit | 6682feedfe5d83e46ec7c942fac22c058f9eace1 (patch) | |
tree | 23b8a7ee729f036328df1817f2030c36b21489cb | |
parent | a8eae67582f67ddee277a8a03d2f2d02fc136011 (diff) | |
download | xmobar-6682feedfe5d83e46ec7c942fac22c058f9eace1.tar.gz xmobar-6682feedfe5d83e46ec7c942fac22c058f9eace1.tar.bz2 |
Dead code elimination (doActionTwiceWithDelay)
-rw-r--r-- | src/Plugins/Monitors/Common.hs | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs index 27ab41c..f2801f9 100644 --- a/src/Plugins/Monitors/Common.hs +++ b/src/Plugins/Monitors/Common.hs @@ -50,13 +50,9 @@ module Plugins.Monitors.Common ( , parseFloat , parseInt , stringParser - -- * Threaded Actions - -- $thread - , doActionTwiceWithDelay ) where -import Control.Concurrent import Control.Monad.Reader import qualified Data.ByteString.Lazy.Char8 as B import Data.IORef @@ -420,22 +416,3 @@ showLogBar f v = do | x <= ll = 1 / bw | otherwise = f + logBase 2 (x / hh) / bw showPercentBar v $ choose v - --- $threads - -doActionTwiceWithDelay :: Int -> IO [a] -> IO ([a], [a]) -doActionTwiceWithDelay delay action = - do v1 <- newMVar [] - forkIO $! getData action v1 0 - v2 <- newMVar [] - forkIO $! getData action v2 delay - threadDelay (delay `div` 3 * 4) - a <- readMVar v1 - b <- readMVar v2 - return (a,b) - -getData :: IO a -> MVar a -> Int -> IO () -getData action var d = - do threadDelay d - s <- action - modifyMVar_ var (\_ -> return $! s) |