On Wed, Apr 23, 2008 at 7:54 AM, Tim Harris (RESEARCH) <[EMAIL PROTECTED]> wrote: > What do you think about a slight change: > > readTVarWhen :: TVar a -> (a -> bool) -> STM a
This seems strictly less powerful than retryUntil: > readTVarWhen v p = retryUntil v p >> readTVar v Consider the following transaction: > intV :: TVar Int > boolV :: TVar Bool > > interesting = atomically $ do > retryUntil intV (> 50) > retryUntil boolV id Lets say that intV contains 100 and boolV contains False. Then this transaction retries. Now, if intV changes to 101, this transaction doesn't need to re-run; we can see immediately that no predicate changed. Using "readTVarWhen", this is less clear; the transaction log would hold a read on intV which would be more difficult to ignore. -- ryan _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
