![]() |
As mentioned above, HPX actions are very similar
to 'normal' C++ functions except that actions can be invoked remotely.
The following table compares the way C++ functions can be invoked with
the syntax used to apply an HPX action. This table
assumes that func
is
an arbitrary C++ function or function object and act
is an instance of an HPX action. R
stands for an arbitrary result type.
Table 15. Comparing C++ Functions and HPX Actions
Invocation |
C++ Function |
HPX Action |
---|---|---|
Apply (fire & forget) |
|
|
Asynchronous |
std::future<R> f = std::async(func, ...); R r = f.get(); hpx::future<R> f = hpx::async(func, ...); R r = f.get(); |
hpx::future<R> f = hpx::async(act, id, ...); R r = f.get(); |
Synchronous |
|
|