LinkTerminated without linked thread?

monarch_dodra monarchdodra at gmail.com
Fri Jan 25 06:20:06 PST 2013


On Friday, 25 January 2013 at 07:33:57 UTC, Stephan wrote:
> On Friday, 25 January 2013 at 01:13:59 UTC, monarch_dodra wrote:
>> [SNIP]
>
>
> Nope. That code works 100% for me.
>
> Stephan

OK. I'm getting a better hang at the semantics of how message 
passing works.

I think I found I've identified the one of the issues I was 
running into though. I don't have much experience with MPI, so I 
don't know if this is a bug, or a user issue. In any case, I'm 
getting inconsistent behavior.

The basic premise of my problem is that one of my workers had a 
full mail box, while being set to "block". If it dies *while* the 
owner is blocked for sending, then the sender is blocked... 
forever.

//----
import std.concurrency, std.stdio;

void worker()
{
     thisTid.setMaxMailboxSize(10, OnCrowding.block);
     Thread.sleep(msecs(1000));
}
void main()
{
     auto wid = spawn(&worker);
     foreach ( i ; 0 .. 20 )
     {
         writeln(i);
         wid.send(i);
     }
}
//----

Basically, the worker sleeps for a second, the mailbox fills. The 
owner waits. The worker then dies, but the owner never wakes :(

The *inconsistent* behavior I'm getting though is that if I 
comment the "writeln(i)", then the program doesn't hang.

Say... what exactly happens when a message is sent to a dead 
thread? Seems like it just silently disappears...


More information about the Digitalmars-d mailing list