| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
July 11, 2012 Re: should a thread print exceptions? | ||||
|---|---|---|---|---|
| ||||
Recieved not a lot of response, maybe I should explain everything a bit more. I'm using multiple threads and one is parsing webpages. I'm prety sure everything works correctly but when an error occurs, I'll enver know. The thread will quit without an error message and I have no idea how to retrieve it. | ||||
July 11, 2012 Re: should a thread print exceptions? | ||||
|---|---|---|---|---|
| ||||
On Jul 9, 2012, at 3:18 AM, maarten van damme wrote:
> When a thread crashes or an assertion fails, should it print out those
> errors (like the main thread)
> Currently it quietly quits without any information whatsoever. Is
> there any way to still make it output that valuable information?
If you join the thread the exception will be re-thrown in the context of the joining thread. I've been considering changing the behavior to terminate the app if an Error is thrown in a thread, but so far have not done this because basically no cleanup would occur, unlike when an Error is thrown in the main thread. Alternately, I've considered having all app threads be actual threads so the main thread wouldn't get special treatment. If we move towards green-threading with std.concurrency this is basically what would be needed anyway, but I'm not sure it's appropriate as the default behavior for a systems language.
| ||||
July 11, 2012 Re: should a thread print exceptions? | ||||
|---|---|---|---|---|
| ||||
On Jul 11, 2012, at 11:47 AM, maarten van damme wrote:
> Recieved not a lot of response, maybe I should explain everything a bit more.
> I'm using multiple threads and one is parsing webpages. I'm prety sure
> everything works correctly but when an error occurs, I'll enver know.
> The thread will quit without an error message and I have no idea how
> to retrieve it.
You might also want to consider using spawnLinked. That would send you a message when the thread terminates.
| ||||
July 12, 2012 Re: should a thread print exceptions? | ||||
|---|---|---|---|---|
| ||||
I think spawnlinked will do the job for me, thank you. | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply