[Haskell-cafe] Shared/Exclusive Locks

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Dec 28 13:38:02 EST 2005

On Wed, Dec 28, 2005 at 05:28:28PM +0000, Chris Kuklewicz wrote:
> But STM, wrapped in small pieces, makes for interesting IO commands
> (untested):

> waitForZero :: (Num a, Ord a) => (TVar a) -> IO ()
> waitForZero tv = atomically $ do
>   v <- readTVar tv
>   when (v>0) retry

This function is rather useless in IO - you will get race conditions.
That's what you get for leaving the STM wonderland ;-)

Best regards

I am searching for a programmer who is good at least in some of
[Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland

More information about the Haskell-Cafe mailing list