Should we have primitive fill-once variables?

David Feuer david at well-typed.com
Fri Jun 29 16:58:16 UTC 2018


On Friday, June 29, 2018 12:19:53 PM EDT Carter Schonwald wrote:
> i'm a little confused, whats the order of reads here?
> Mvars have write wins, whats the order here?  last writer runs first, first
> writer runs last? (wouldn't there be starvation issues?)

Writes would occur in no particular order (very much like atomicWriteIORef). Blocked reads would occur from last to first, and I think that's okay. If you think about this as being primarily intended to implement IVars, but with a little extra flexibility, you should get the right intuition.


More information about the ghc-devs mailing list