Using objects that manage threads via std.concurrency

Jonathan M Davis jmdavisProg at gmx.com
Mon Feb 11 23:06:10 PST 2013


On Tuesday, February 12, 2013 07:58:04 monarch_dodra wrote:
> How can I get my 3 managers to co-exist, when they are all
> sharing the same box? How can I make sure the workers are sending
> their messages to the correct manager?

By making it so that their receiving functions take unique types. If need be, 
you can declare types specific to the channel of communication that you're 
trying to create. Then only functions which match will receive those messages.

> > It is possible to introduce threads to each other by their
> > thread ids, which can be mapped to arbitrary names. (See
> > register, locate, and unregister in std.concurrency.)
> 
> Yes, but in this case, the problem is not thread to thread
> communication, but rather thread to object

Which I don't think was ever really intended. That doesn't mean that it's 
unreasonable, but I think that it was always the idea that a particular thread 
had a particular job, in which case, you wouldn't generally be trying to send 
messages to different parts of the thread.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list