Thread overview | |||||
---|---|---|---|---|---|
|
October 09, 2012 How can I know that all child thread are gone out? | ||||
---|---|---|---|---|
| ||||
Hello I spawn several threads and now I need to know if they has finished their job. Before I do it by means of messages from child threads to the main one to inform about finishing. But I'm sure this isn't good enough, because a child thread may fail before sending the exit message to the main thread and the application will hang up. So I'd like to check from the main thread if child threads are gone away. How can I do it? |
October 09, 2012 Re: How can I know that all child thread are gone out? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Druzhinin Alexandr | On 09.10.2012 22:44, Druzhinin Alexandr wrote:
> Hello
> I spawn several threads and now I need to know if they has finished
> their job. Before I do it by means of messages from child threads to the
> main one to inform about finishing. But I'm sure this isn't good enough,
> because a child thread may fail before sending the exit message to the
> main thread and the application will hang up. So I'd like to check from
> the main thread if child threads are gone away. How can I do it?
Oops, I've totally missed core.thread. I'll correct this.
|
October 09, 2012 Re: How can I know that all child thread are gone out? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Druzhinin Alexandr | On Oct 9, 2012, at 8:44 AM, Druzhinin Alexandr <news@digitalmars.com> wrote:
> Hello
> I spawn several threads and now I need to know if they has finished their job. Before I do it by means of messages from child threads to the main one to inform about finishing. But I'm sure this isn't good enough, because a child thread may fail before sending the exit message to the main thread and the application will hang up. So I'd like to check from the main thread if child threads are gone away. How can I do it?
ThreadGroup.joinAll or spawnLinked if using std.concurrency.
|
Copyright © 1999-2021 by the D Language Foundation