<div class="gmail_quote">On Wed, Jan 20, 2010 at 1:28 AM, Andrei Alexandrescu <span dir="ltr">&lt;<a href="mailto:andrei@erdani.com">andrei@erdani.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
That would certainly work, but honest to God I am completely infatuated with the proposed model. It&#39;s simple, no need for a new &quot;daemon&quot; concept, and avoids very easily and elegantly the unpleasant zombie situation when main has finished but is somewhere in limbo mode hoping for some other thread to end.<br>

<br>
Also, look at how simple it makes all examples. It&#39;s a dream come true. I&#39;ve been thinking of a correct shutdown protocol for years, and this is better than anything I&#39;ve ever tried.<br>
<br>
I&#39;d be ok with doing what Java does if we find an Achilles&#39; heel of the current model. If not, I suggest we go with it and let users handle their own daemons (heh) in main().<br><font color="#888888">
<br>
<br>
Andrei</font><div><div></div><div class="h5"><br></div></div></blockquote><div><br>I really like the exception concept, by the way.  But I still think that if there is no way to send normal messages once the shutdown phase begins, you will see a small crop of schemes for sending messages in some other way to coordinate shutdown.  (Moreso on network based systems which tend to have sharper division of &#39;ownership of role&#39;.)  I&#39;ve been on a team that had to invent such things ourselves.<br>
<br>Kevin<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5">
<br>
Sean Kelly wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Jan 19, 2010, at 9:49 PM, Andrei Alexandrescu wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.<br>
</blockquote>
<br>
Why couldn&#39;t any threads that cared simply watch() the main thread so they&#39;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&#39;t communicate with the main thread, he&#39;d have to make sure the main thread joined every other thread in the process to keep from interrupting it.<br>

<br>
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?<br>

_______________________________________________<br>
dmd-concurrency mailing list<br>
<a href="mailto:dmd-concurrency@puremagic.com" target="_blank">dmd-concurrency@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-concurrency" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-concurrency</a><br>
</blockquote>
_______________________________________________<br>
dmd-concurrency mailing list<br>
<a href="mailto:dmd-concurrency@puremagic.com" target="_blank">dmd-concurrency@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-concurrency" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-concurrency</a><br>
</div></div></blockquote></div><br>