(sorry, ignore that -- accidentally bumped the send.)<br><br><div class="gmail_quote">On Wed, Jan 20, 2010 at 2:08 AM, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:andrei@erdani.com">andrei@erdani.com</a>></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;">I'm getting message from you that quote some other messages but have no other content.<br>
<br>
Andrei<br>
<br>
Kevin Bealer wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
On Wed, Jan 20, 2010 at 1:50 AM, Andrei Alexandrescu <<a href="mailto:andrei@erdani.com" target="_blank">andrei@erdani.com</a> <mailto:<a href="mailto:andrei@erdani.com" target="_blank">andrei@erdani.com</a>>> wrote:<br>
<br>
Sean Kelly wrote:<br>
<br>
void fnB() {<br>
// do something that takes a while<br>
}<br>
void fnA() {<br>
spawn( &fnB );<br>
}<br>
<br>
void main() {<br>
auto tid = spawn( &fnA );<br>
tid.wait();<br>
}<br>
<br>
The main thread doesn't know the thread running fnB exists so it<br>
can't wait for it, even if it's doing completely legitimate work<br>
and shouldn't be interrupted. How can I trivially rewrite this<br>
program so it completes without error?<br>
<br>
<br>
If fnB does legitimate work and doesn't call concurrency-related<br>
routines, it will be waited for.<br>
<br>
If fnB does call concurrency-related routines, it must end when<br>
main() exits. To me exiting main() is a no-quarters situation: it<br>
means the application is to exit asap. I find it weird to think of<br>
programs that finish main() but continue to do stuff.<br>
<br>
To make sure everything is accounted for, the application design<br>
must be such that main() doesn't exit until useful threads are done.<br>
<br>
<br>
Andrei<br>
<br>
_______________________________________________<br>
dmd-concurrency mailing list<br></div></div>
<a href="mailto:dmd-concurrency@puremagic.com" target="_blank">dmd-concurrency@puremagic.com</a> <mailto:<a href="mailto:dmd-concurrency@puremagic.com" target="_blank">dmd-concurrency@puremagic.com</a>><div class="im">
<br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-concurrency" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-concurrency</a><br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="im"><br>
<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>
</div></blockquote><div><div></div><div class="h5">
_______________________________________________<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>