Open kayceesrk opened 9 years ago
I changed the update reagent into something else for now. It no longer takes a "partial" function. And is just syntactic sugar on CAS (and computed). Maybe it should be renamed, but this one is super useful anyway.
As for the "real" update reagent it should not use usual CAS references. (maybe a "state" data structure?)
Yeah. If we do call it State
, we should clearly distinguish from Ref
since both modules provide the same interface (read
, cas
, update
, etc) but their semantics are very different. While Ref
is non-blocking, State
is blocking.
Sounds good to me.
update r f
should block iff
returnsNone
instead of failing forever withnever
. The thread performing the update should be woken up when the reference is updated. This is similar to an STM's commit log.