[dmd-concurrency] Defining shared delegates

Sean Kelly sean at invisibleduck.org
Tue Jan 19 20:58:21 PST 2010


On Jan 19, 2010, at 7:14 PM, Andrei Alexandrescu wrote:

> Robert Jacques wrote:
> 
>> As for draft comments, spawn shouldn't be returning a thread id, it should be returning a message box id, because message passing won't be limited to OS threads, so your examples shouldn't imply that it is.
> 
> Actually it's good as it is. The types of messages accepted by threads are different from those accepted by processes.

the important thing is that the returned type is always the same.  I suggested Cid (for context id) instead of Tid, but it may be a bit vague.  The way the message passing API is implemented right now for in-process messaging only is:

struct Cid
{
private:
    Mailbox mbox;
    this(Mailbox m) { mbox = m; }
}

ie. it's completely opaque.  Once inter-process messaging is added, Cid will probably get some more fields.

>> You should also have an example using a separately created mailbox and an CSP style alternative example where multiple mailboxes are waited upon.
> 
> Could you provide more detail? I don't know much about CSP, so in all likelihood I'll need to absorb some information first. (Fortunately Sean does.)

I'm a bit rusty, to be fair.  but for anyone interested in the paper, I've put a copy here:

http://invisibleduck.org/sean/tmp/csp.pdf


More information about the dmd-concurrency mailing list