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

Asio integration: link error in yield.hpp included in different cpp #263

Open
malirod opened this issue Nov 4, 2020 · 1 comment
Open

Comments

@malirod
Copy link

malirod commented Nov 4, 2020

In the file examples/asio/yield.hpp there is the line

thread_local yield_t yield{};

So if this yield.hpp included in two different cpp files then there will be link issue.

If existing code will be changed with following then issue is solved.

inline yield_t& this_yield() {
  thread_local yield_t yield;
  return yield;
}
@bitbugprime
Copy link

If you have C++17 it would be simpler to declare the global variable itself inline.

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

No branches or pull requests

2 participants