Asynchronous concurrency with reference types

Sean Kelly sean at invisibleduck.org
Fri Feb 4 15:44:59 PST 2011


Peter Alexander Wrote:
> 
> How would you do it with message passing though? As I understand, all of 
> the std.concurrency message passing routines are blocking, and I need 
> this to be asynchronous.

What do you mean by blocking?  The receive call will block until a message matching one of the supplied types arrives, but if you don't like this you can always use receiveTimeout.  send() doesn't deep copy objects, so the only reference types send() will currently accept are those labeled as shared or immutable (Unique!T will probably be added at some point, which is more appropriate for your situation).  So to use send() known unique reference data you'll have to cast to/from shared or immutable.  Nasty, but it'll work.


More information about the Digitalmars-d-learn mailing list