If msg A is sent before B is the asynchronous function above, always process A to B?
Yes. (You can see the code for the mailbox
http://fsharppowerpack.codeplex.com/SourceControl/changeset/view/54799#970072
go to the compiler \ 2.0 \ Nov2010 \ src \ fsharp \ FSharp.Core \ control.fs and, in the end, see, for example,
member x.Post(msg) = lock syncRoot (fun () -> arrivals.Enqueue(msg); ...
which shows that it's just a turn under lock and key.)
It seems like such a class should already exist in F #? Am I reinventing the wheel?
Well, it’s not immediately clear to me how this differs from simply modifying the volatile global variable willy-nilly (modulo atomicity of simultaneous updates, you said “earlier” in the question, so it’s not clear to you whether this aspect has a question). What is the context for this?
source share