
On 4/22/08, Chris Smith
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?
Of course not; the semantics would be that the transaction log, instead of saying "I read from v" would say "I read from v and failed because v didn't satisfy this predicate". Changes to any other variable in the log would have the same effect as always: restarting the transaction. This is actually required in my desired use case; I want to block until "now" becomes >= t, or a different TVar gets filled with a non-Nothing value. -- ryan