From: Don Stewart Date: Thu, 28 Feb 2008 23:44:43 +0000 (+0000) Subject: untabify X-Git-Tag: 2008-05-28~54 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a13d69bfcfcbb4317d3d0e80b88f70dda98a8994;p=ghc-base.git untabify --- diff --git a/Control/Concurrent/QSem.hs b/Control/Concurrent/QSem.hs index 5a512d8..0258810 100644 --- a/Control/Concurrent/QSem.hs +++ b/Control/Concurrent/QSem.hs @@ -13,12 +13,12 @@ ----------------------------------------------------------------------------- module Control.Concurrent.QSem - ( -- * Simple Quantity Semaphores - QSem, -- abstract - newQSem, -- :: Int -> IO QSem - waitQSem, -- :: QSem -> IO () - signalQSem -- :: QSem -> IO () - ) where + ( -- * Simple Quantity Semaphores + QSem, -- abstract + newQSem, -- :: Int -> IO QSem + waitQSem, -- :: QSem -> IO () + signalQSem -- :: QSem -> IO () + ) where import Prelude import Control.Concurrent.MVar @@ -54,13 +54,13 @@ waitQSem (QSem sem) = do else do block <- newEmptyMVar {- - Stuff the reader at the back of the queue, - so as to preserve waiting order. A signalling - process then only have to pick the MVar at the - front of the blocked list. + Stuff the reader at the back of the queue, + so as to preserve waiting order. A signalling + process then only have to pick the MVar at the + front of the blocked list. - The version of waitQSem given in the paper could - lead to starvation. + The version of waitQSem given in the paper could + lead to starvation. -} putMVar sem (0, blocked++[block]) takeMVar block @@ -73,5 +73,5 @@ signalQSem (QSem sem) = do [] -> putMVar sem (avail+1,[]) (block:blocked') -> do - putMVar sem (0,blocked') - putMVar block () + putMVar sem (0,blocked') + putMVar block ()