digitalmars.D.bugs - [Issue 6126] New: std.parallelism does not re-throw exception
- d-bugmail puremagic.com (37/37) Jun 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6126
- d-bugmail puremagic.com (31/31) Jun 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6126
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 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: -------
Jun 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6126 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID 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: -------
Jun 08 2011