What would you do...

Sean Kelly sean at invisibleduck.org
Thu Dec 8 17:12:17 PST 2011


On Dec 8, 2011, at 4:13 PM, Andrew Wiley wrote:
> 
> This is somewhat of a threadjack, but I was looking at making a
> lighter actor-like abstraction for message passing, and possibly
> making it compatible with std.concurrency, and I saw this:
> "The general idea is that every messageable entity is represented by a
> common handle type (called a Cid in this implementation), which allows
> messages to be sent to in-process threads, on-host processes, and
> foreign-host processes using the same interface."
> 
> As far as I can tell, Cid does not appear outside the documentation at
> the top of std.concurrency, and Tid is a direct linkage to
> std.concurrency's private mailbox implementation, so I was wondering
> what the best way to extend message-passing functionality to another
> type would be.

Originally I'd thought that Tid would be process-local and we'd have a different type for external stuff, but that sacrifices a lot of the power of the actor model.  However, I think everything can be handled by the one Tid type.  The real trick is meshing the template-driven send() operation with different transport (and serialization) schemes, but I've become convinced that this can work.  At some point a Node type will be added, and Nodes will have a transport interface.  So calling send() on a Tid that contains a Node reference will serialize to the transport layer.  If the Node reference is null then it will work as it does now.  So what you'll ultimately want to do is provide a transport mechanism for the method you desire.


More information about the Digitalmars-d mailing list