The actors in std.concurrency - in this example it's non-deterministic
whether the process may or may not hang. I'm confused as to why. I have
set the mailbox sizes to 1. But the message flow seems simple enough. I
don't see how the message limit of 1 is blocking everything, I am
catching Variant messages so nothing should be in the mailbox unread.

I have struggled with a similar problem recently. When an apparent
lock-up occurs, it may be because a worker has terminated, likely by
assert(). (There has been a thread about exceptions from workers getting
lost.)
The trick is to start the worker with spawnLinked so that a
LinkTerminated exception can be received on the owner's side:
tids[i] = spawnLinked(&blah1, thisTid);
// ...
(LinkTerminated exc)
{
writeln("A worker has terminated: ", exc);
// ...
},
The other std.concurrency exception that can be received as a message is
OwnerTerminated:
(OwnerTerminated exc)
{
writeln("The owner has terminated; exiting.");
isDone = true;
}
I am in the process of updating the following page with the information
above:
http://ddili.org/ders/d.en/concurrency.html
Ali

Excellent, it was a rogue exception in another program that was
causing hangs and issues for me. Thanks :)
On Tuesday, 24 July 2012 at 15:33:34 UTC, Ali Çehreli wrote:

On 07/24/2012 07:46 AM, Enerqi wrote:

The actors in std.concurrency - in this example it's

non-deterministic

whether the process may or may not hang. I'm confused as to

why. I have

set the mailbox sizes to 1. But the message flow seems simple

enough. I

don't see how the message limit of 1 is blocking everything,

I am

catching Variant messages so nothing should be in the mailbox

unread.
I have struggled with a similar problem recently. When an
apparent lock-up occurs, it may be because a worker has
terminated, likely by assert(). (There has been a thread about
exceptions from workers getting lost.)
The trick is to start the worker with spawnLinked so that a
LinkTerminated exception can be received on the owner's side:
tids[i] = spawnLinked(&blah1, thisTid);
// ...
(LinkTerminated exc)
{
writeln("A worker has terminated: ", exc);
// ...
},
The other std.concurrency exception that can be received as a
message is OwnerTerminated:
(OwnerTerminated exc)
{
writeln("The owner has terminated; exiting.");
isDone = true;
}
I am in the process of updating the following page with the
information above:
http://ddili.org/ders/d.en/concurrency.html
Ali