From 6682feedfe5d83e46ec7c942fac22c058f9eace1 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 13 Feb 2011 05:34:56 +0100 Subject: Dead code elimination (doActionTwiceWithDelay) --- src/Plugins/Monitors/Common.hs | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'src/Plugins/Monitors/Common.hs') 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) -- cgit v1.2.3