[ Version ( since = "0.4.0-alpha" ) ]
public Future<G> task<G> (owned TaskFunc<G> func)
Increases the counter by one and schedules the given function to execute. Next, decreases the counter by one after the function is executed.
This is equivalent to:
waitgroup.add();
return Gpseq.task<G>(() => {
try {
G result = func();
return (owned) result;
} catch (Error err) {
throw err;
} finally {
waitgroup.done();
}
});
func |
a task function to execute |
a future of the execution |