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

Add this_thread namespace #1030

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add this_thread namespace #1030

wants to merge 1 commit into from

Conversation

chusitoo
Copy link

First and foremost, thank you for this gread lib. In the current project, I have to make a call to this_thread::sleep_for() in parts of the implementation (using a separate thread for endpoint). In order to respect the current design that makes a distinction between boost and stl, I've added a quick patch in my code that looks something like this:

#ifndef _WEBSOCKETPP_CPP11_STL_
#include <boost/thread/thread.hpp>
#endif

...

namespace websocketpp {
namespace lib {
#ifdef _WEBSOCKETPP_CPP11_STL_
namespace this_thread = std::this_thread;
#else
namespace this_thread = boost::this_thread;
#endif
} // namespace lib
} // namespace websocketpp

...

websocketpp::lib::this_thread::sleep_for(websocketpp::lib::chrono::milliseconds(1000));

Ideally, I'd see this as code that thread.hpp would take care of, which is exactly the goal of this PR.

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

Successfully merging this pull request may close these issues.

1 participant