Skip to content

Latest commit

History

54 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

async

The framework for supporting a style of parallel programming in which problems are solved by (recursively) splitting them into subtasks that are solved in parallel, waiting for them to complete, and then composing results.

The fork/join framework provides a very straightforward and intuitive structure to conquer problems.

example

intsequentialFibonacci(n);
voidcombineFibonacci(int x, int y, function<void(int)> sendResult)
{
sendResult(x + y);
}
voidcalculateFibonacci(asio::io_service& theService, int n, function<void(int)> onComplete)
{
if (n <= threshold)
{
onComplete(sequentialFibonacci(n));
}
else
{
async<void(int), void(int)>(
io_service,
bind(calculateFibonacci, ref(theService), n - 1, _1),
bind(calculateFibonacci, ref(theService), n - 2, _1),
bind(combineFibonacci, _1, _2, onComplete));
}
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages