[dmd-concurrency] draft 5
Sean Kelly
sean at invisibleduck.org
Tue Jan 19 22:14:02 PST 2010
On Jan 19, 2010, at 9:49 PM, Andrei Alexandrescu wrote:
> Sorry, I was unclear on that. Once the application is shutting down, any call to concurrency-related function, pending or new, will result in the Shutdown exception.
Why couldn't any threads that cared simply watch() the main thread so they'll be notified when it terminates? Forcing this behavior on the user means that if an app wants to do anything in a separate thread that doesn't communicate with the main thread, he'd have to make sure the main thread joined every other thread in the process to keep from interrupting it.
Druntime follows the Java model of having an isDaemon field on the Thread object. If isDaemon is false for a thread T1 then the main thread will silently wait for T1 to terminate before shutting down the app. If isDaemon is true however, T1 will be terminated forcibly by the OS as the process exits. Perhaps we could provide this ShutdownException behavior only to daemon threads as a replacement for the messy shutdown they have now?
More information about the dmd-concurrency
mailing list