[dmd-concurrency] Sending mesages to non-listening threads
    Andrei Alexandrescu 
    andrei at erdani.com
       
    Tue Jan 12 14:26:03 PST 2010
    
    
  
Michel Fortin wrote:
> It's nice that you can now send messages to any thread like this:
> 
> 	tid.send(i);
> 
> But... what if you're sending a message to the wrong thread, to a thread that isn't listening for messages? Do the messages accumulate in memory until no memory is left? If that's the case, sending messages to the wrong thread would become a memory leak. Any solution?
I think mailbox crowding is a liability of message-passing systems in 
general. We can mitigate that in a number of ways, including an API for 
threads to set a ceiling for their mailbox:
enum OnCrowding { wait, throwException }
setMaxMailboxSize(size_t messages, OnCrowding doThis);
Andrei
    
    
More information about the dmd-concurrency
mailing list