Skip to content

Update boost to std #589

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

Merged
merged 15 commits into from
Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replaced boost::mutex with std::mutex.
  • Loading branch information
glynos committed Jan 29, 2016
commit f4f6a86bbf3931f1de517c7008001f8fef7cc00b
6 changes: 3 additions & 3 deletions boost/network/protocol/http/policies/pooled_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <mutex>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/network/protocol/http/client/connection/sync_base.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/unordered_map.hpp>
#include <utility>

Expand Down Expand Up @@ -181,7 +181,7 @@ struct pooled_connection_policy : resolver_policy<Tag>::type {
typedef std::shared_ptr<connection_impl> connection_ptr;

typedef unordered_map<string_type, std::weak_ptr<connection_impl>> host_connection_map;
boost::mutex host_mutex_;
std::mutex host_mutex_;
host_connection_map host_connections_;
bool follow_redirect_;
int timeout_;
Expand All @@ -197,7 +197,7 @@ struct pooled_connection_policy : resolver_policy<Tag>::type {
optional<string_type> const& ciphers = optional<string_type>()) {
string_type index =
(request_.host() + ':') + lexical_cast<string_type>(request_.port());
boost::mutex::scoped_lock lock(host_mutex_);
std::unique_lock<mutex> lock(host_mutex_);
auto it = host_connections_.find(index);
if (it != host_connections_.end()) {
// We've found an existing connection; but we should check if that
Expand Down
8 changes: 4 additions & 4 deletions boost/network/protocol/http/server/async_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <mutex>
#include <boost/network/detail/debug.hpp>
#include <boost/network/protocol/http/server/async_connection.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/network/protocol/http/server/storage_base.hpp>
#include <boost/network/protocol/http/server/socket_options_base.hpp>
#include <boost/network/utils/thread_pool.hpp>
Expand All @@ -28,7 +28,7 @@ struct async_server_base : server_storage_base, socket_options_base {
response_header;
typedef async_connection<Tag, Handler> connection;
typedef std::shared_ptr<connection> connection_ptr;
typedef boost::unique_lock<boost::mutex> scoped_mutex_lock;
typedef std::unique_lock<std::mutex> scoped_mutex_lock;

explicit async_server_base(server_options<Tag, Handler> const &options)
: server_storage_base(options),
Expand Down Expand Up @@ -87,8 +87,8 @@ struct async_server_base : server_storage_base, socket_options_base {
asio::ip::tcp::acceptor acceptor;
bool stopping;
connection_ptr new_connection;
boost::mutex listening_mutex_;
boost::mutex stopping_mutex_;
std::mutex listening_mutex_;
std::mutex stopping_mutex_;
bool listening;
std::shared_ptr<ssl_context> ctx_;

Expand Down
6 changes: 3 additions & 3 deletions boost/network/protocol/http/server/sync_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define BOOST_NETWORK_PROTOCOL_HTTP_SERVER_SYNC_SERVER_HPP_20101025

#include <memory>
#include <mutex>
#include <boost/network/detail/debug.hpp>
#include <boost/bind.hpp>
#include <boost/asio/ip/tcp.hpp>
Expand All @@ -19,7 +20,6 @@
#include <boost/network/protocol/http/server/socket_options_base.hpp>
#include <boost/network/protocol/http/server/options.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/mutex.hpp>

namespace boost {
namespace network {
Expand Down Expand Up @@ -58,7 +58,7 @@ struct sync_server_base : server_storage_base, socket_options_base {
}

void listen() {
boost::unique_lock<boost::mutex> listening_lock(listening_mutex_);
std::unique_lock<std::mutex> listening_lock(listening_mutex_);
if (!listening_) start_listening();
}

Expand All @@ -67,7 +67,7 @@ struct sync_server_base : server_storage_base, socket_options_base {
string_type address_, port_;
boost::asio::ip::tcp::acceptor acceptor_;
std::shared_ptr<sync_connection<Tag, Handler> > new_connection;
boost::mutex listening_mutex_;
std::mutex listening_mutex_;
bool listening_;

void handle_accept(boost::system::error_code const& ec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include <memory>
#include <mutex>
#include <boost/network/include/http/server.hpp>
#include <boost/network/uri.hpp>

Expand Down Expand Up @@ -46,16 +47,16 @@ struct work_queue {
typedef std::list<request_data::pointer> list;

list requests;
boost::mutex mutex;
std::mutex mutex;

inline void put(const request_data::pointer& p_rd) {
boost::unique_lock<boost::mutex> lock(mutex);
std::unique_lock<std::mutex> lock(mutex);
requests.push_back(p_rd);
(void)lock;
}

inline request_data::pointer get() {
boost::unique_lock<boost::mutex> lock(mutex);
std::unique_lock<std::mutex> lock(mutex);

request_data::pointer p_ret;
if (!requests.empty()) {
Expand Down