Let's say that I call MailboxProcessor.PostAndReply, which may run for a very long time due to whatever reasons. What would happen if I call MailboxProcessor.Post from some other thread while the first call has not returned yet?
What I mean is, yeah, sure, I can write a test that would recreate this situation. However, before I start reinventing the bicycle, I wonder if anyone already knows the answer on this question.
Thanks a lot!
The short answer: no, it doesn't block.
The longer version: Mailbox processor uses a regular
Queue<T>instead of aConcurrentQueue<T>- which means posting uses a lock to enqueue, meaning that if a post were to be called from two different threads, one would block the thread till the other call returned - which would happen very fast, but block.tl;dr: Post does not block is so far as no actual work is done on posting.