June 08, 2011 [Issue 6126] New: std.parallelism does not re-throw exception | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6126 Summary: std.parallelism does not re-throw exception Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: robert@octarineparrot.com --- Comment #0 from Robert Clipsham <robert@octarineparrot.com> 2011-06-08 21:17:51 BST --- The following code: ---- import std.exception; import std.parallelism; void foo(int task) { enforce(task != 4); } void main() { int[] tasks = [1, 2, 3]; taskPool.put(task!foo(4)); foreach (task; taskPool.parallel(tasks)) { foo(task); } } ---- Does not re-throw the exception when the task uses .put() then .parallel() is used to run the tasks. Changing the enforcement to == causes three exceptions to be thrown as expected. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 09, 2011 [Issue 6126] std.parallelism does not re-throw exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | http://d.puremagic.com/issues/show_bug.cgi?id=6126 David Simcha <dsimcha@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #1 from David Simcha <dsimcha@yahoo.com> 2011-06-08 19:30:43 PDT --- Exceptions thrown from within tasks are re-thrown when you call done(), workForce(), yieldForce(), or spinForce() on the Task object. You created an anonymous task and never called any of these functions. The following slightly modified code does re-throw the exception. import std.exception; import std.parallelism; void foo(int task) { enforce(task != 4); } void main() { int[] tasks = [1, 2, 3]; auto t = task!foo(4); taskPool.put(t); foreach (task; taskPool.parallel(tasks)) { foo(task); } t.yieldForce(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation