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

Support BOOST_ASIO_NO_DEPRECATED (Linux, pplx) #1323

Open
rcasellas opened this issue Feb 6, 2020 · 0 comments
Open

Support BOOST_ASIO_NO_DEPRECATED (Linux, pplx) #1323

rcasellas opened this issue Feb 6, 2020 · 0 comments

Comments

@rcasellas
Copy link

rcasellas commented Feb 6, 2020

Hi all,

When adding -DBOOST_ASIO_NO_DEPRECATED to my project (we are migrating from old versions), our build fails. Newer ASIO versions deprecate io_service (use io_context), post is a now a free function, a few API changes (e.g. expires_after), etc.

/usr/include/pplx/threadpool.h:75:18: error: ‘io_service’ in namespace ‘boost::asio’ does not name a type; did you mean ‘has_service’?

/usr/include/pplx/threadpool.h: In member function ‘void crossplat::threadpool::schedule(T)’:
/usr/include/pplx/threadpool.h:72:9: error: there are no arguments to ‘service’ that depend on a template parameter, so a declaration of ‘service’ must be available [-fpermissive]

/usr/include/pplx/threadpool.h:78:38: error: class ‘crossplat::threadpool’ does not have any field named ‘m_service’

This specific error would need changes like the ones below but I wonder if there are other parts (exposed to library clients) that may need change and other implications. Thoughts?
Thanks,
R.

   template<typename T>
    CASABLANCA_DEPRECATED("Use `.service().post(task)` directly.")
    void schedule(T task)
    {
        // service().post(task);
        boost::asio::post(service(), task);
    }

    boost::asio::io_context& service() { return m_service; }

protected:
    threadpool(size_t num_threads) : m_service(static_cast<int>(num_threads)) {}

    boost::asio::io_context m_service;
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

1 participant