[dmd-concurrency] draft 4

Steve Schveighoffer schveiguy at yahoo.com
Tue Jan 12 10:28:47 PST 2010


----- Original Message ----

> From: Sean Kelly <sean at invisibleduck.org>
>
> I've considered having the sender's Tid automatically embedded in every 
> message.  Seems like it's pretty much always wanted, though this would mean not 
> being able to use just any old delegate for receiving messages.  ie. if you have 
> a function already that accepts a Foo then would you want to use that directly 
> or would it be a bother to wrap it in something to throw away the Tid?

I'm not sure it's always wanted.

In one application I developed, there was a server event thread that received events from all the other threads when an object changed, and broadcast those events to all clients of the server.  This was in C#, so all the objects were "shared", and all used synchronized methods to update.  The clients (and therefore the event thread) didn't care what server thread changed the object, they just cared what object changed.

My point is, you generally *do* want to know some "return address" for a message, but it's not always going to be the Tid.

Another thing, you may only ever expect certain messages from certain threads, or a message may be an instruction that doesn't need a response (i.e. application is closing, cleanup and exit as soon as possible).  You don't need to verify or use the sender in those cases, so you would be wasting time and resources copying the Tid in such cases.

-Steve



      


More information about the dmd-concurrency mailing list