What would you do...

Sean Kelly sean at invisibleduck.org
Thu Dec 8 15:41:03 PST 2011


On Dec 8, 2011, at 7:51 AM, Manu wrote:
> 
> The std.concurrency documentation is pretty bad.
> So is std.concurrency.spawn() just effectively a helper for spawning a thread that has mailbox support?

Yes.  Plus some restrictions on arguments to the new thread to help prevent data races.

> std.concurrency.receive() has no documentation ;) .. Blocking/Non-blocking? Should I use the one with duration==0 to do a poll? Perhaps there should be an explicit poll() method?
> What is prioritySend()? (also undocumented)

This is my fault.  I suppose I should do something about this for the next release.  Priority messages basically live in a separate message queue.  When receive is called, if the priority queue is non-empty then the receive() pattern is applied to that.  If that receive() call can't handle one of the priority messages an exception is thrown.  So long as the priority queue remains empty, receive() will block until a message arrives that it can handle.  If you want non-blocking behavior then call receiveTimeout() instead.


More information about the Digitalmars-d mailing list