Asio integration: link error in yield.hpp included in different cpp
malirod opened this issue · 1 comments
malirod commented
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 commented
If you have C++17 it would be simpler to declare the global variable itself inline.