On Tue, 22 Apr 2008 14:48:54 -0700, Ryan Ingram wrote:
> waitFor t0 = do
>     t <- readTVar now
>     if (t < t0) then retry else return ()
> 
> This naive implementation has the problem that the transaction gets
> restarted every time "now" gets updated, even if the new value is still
> less than t0.
> 
> One primitive that would be strong enough is this: retryUntil :: TVar a
> -> (a -> Bool) -> STM ()

Hmm.  This makes me suspicious.  A change to a variable may change the 
transaction such that it never even calls your retryUntil the next time 
around.  Is it really safe to not retry the transaction?

-- 
Chris Smith

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to