Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation problem #4519

Closed
hkaiser opened this issue Apr 14, 2020 · 1 comment · Fixed by #4538
Closed

Documentation problem #4519

hkaiser opened this issue Apr 14, 2020 · 1 comment · Fixed by #4538

Comments

@hkaiser
Copy link
Member

hkaiser commented Apr 14, 2020

From IRC:

[13:23]	tiagofg[m]: I noticed that in HPX documentation, in the 
section "2.5.6 Writing single-node HPX applications", in "channels", 
the example that is there has a mistake. When I do "cout << c.get();" 
will fail, because get() return a future.
[13:25]	tiagofg[m]: to obtain the value 42, I think the solution 
may be "cout << c.get().get();" or "cout << c.get(hpx::launch::sync);"
@msimberg
Copy link
Contributor

Would it actually be more canonical to write the example as the following to make it clear that c.get() returns a future (even though it's silly in this tiny example):

hpx::lcos::local::channel<int> c;
hpx::future<int> f = c.get();
// f.is_ready() == false
c.set(42);
// f.is_ready() == true
cout << f.get();

We can have the hpx::launch::sync as well. I'll grab these from tests (or add an example/test if there are no suitable ones) so that we know that the example compiles...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants