digitalmars.D.bugs - [Issue 10126] New: Make TaskPool terminate on its own or improve docs to make it clear that it won't
- d-bugmail puremagic.com (40/40) May 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10126
http://d.puremagic.com/issues/show_bug.cgi?id=10126 Summary: Make TaskPool terminate on its own or improve docs to make it clear that it won't Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: jmdavisProg gmx.com PDT --- This program will never exit: import std.parallelism; import std.stdio; void main() { auto pool = new TaskPool; writeln("Exiting..."); } It prinst "Exiting..." and then just sits there. After poking at this for a couple of hours, I finally figured out that you have to call finish on the TaskPool to get it to terminate. My first inclination is that the threads should properly terminate when the main thread terminates and that it's a bug that they don't, but it may very well be that they have to work that way for one reason or another. But the docs are _not_ clear on this point. After digging through the docs in std.parallelism, I see some mention in stuff like taskPool of needing to call finish normally, but the main TaskPool docs say nothing of the sort. So, please either make it so that the TaskPool's threads terminate when main does or clarify TaskPool's documentation so that the correct usage is clear. There probably needs to be an example on TaskPool on its proper usage so that it's clear that finish needs to be called (as well as any other quirks of which I'm not aware). Otherwise, it's too easy to miss them and end up with a program that won't terminate for no obvious reason. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 21 2013