On 06/03/2013 12:30 AM, Alexandr Druzhinin wrote:

> if child thread throws an exception,
> should it print some diagnostic message to clear that it crashed or no?

No, the parent does not know about such a termination. These are the following options that I know of:

1) The exceptions can be caught by the child and sent to the owner explicitly as a special message that both understand.

Or the exception can directly be passed as a message:

2)
    try {
        // ...

    } catch (shared(Exception) exc) {
        owner.send(exc);
    },

The owner receives that message just like a message:

    receive(
        // ...

        (shared(Exception) exc) {
            throw exc;
        });

The code above re-throws the child's exception in the owner's context but it could do anything else as well.

There are also the following exceptions that are related to std.concurrency:

* MessageMismatch
* OwnerTerminated
* LinkTerminated
* MailboxFull
* PriorityMessageException

I have some examples here:

  http://ddili.org/ders/d.en/concurrency.html

Ali

Reply via email to