task


Description:

[ 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();
}
});

Parameters:

func

a task function to execute

Returns:

a future of the execution

See also:

Gpseq.task