Skip to content

Commit 5c83104

Browse files
committed
Updated multithreaded codebase
Updated asio library
1 parent 4bb9811 commit 5c83104

File tree

376 files changed

+33570
-13915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+33570
-13915
lines changed

include/asio.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# pragma once
1616
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
1717

18+
#include "asio/associated_allocator.hpp"
19+
#include "asio/associated_executor.hpp"
1820
#include "asio/async_result.hpp"
1921
#include "asio/basic_datagram_socket.hpp"
2022
#include "asio/basic_deadline_timer.hpp"
@@ -29,6 +31,7 @@
2931
#include "asio/basic_stream_socket.hpp"
3032
#include "asio/basic_streambuf.hpp"
3133
#include "asio/basic_waitable_timer.hpp"
34+
#include "asio/bind_executor.hpp"
3235
#include "asio/buffer.hpp"
3336
#include "asio/buffered_read_stream_fwd.hpp"
3437
#include "asio/buffered_read_stream.hpp"
@@ -43,8 +46,13 @@
4346
#include "asio/datagram_socket_service.hpp"
4447
#include "asio/deadline_timer_service.hpp"
4548
#include "asio/deadline_timer.hpp"
49+
#include "asio/defer.hpp"
50+
#include "asio/dispatch.hpp"
4651
#include "asio/error.hpp"
4752
#include "asio/error_code.hpp"
53+
#include "asio/execution_context.hpp"
54+
#include "asio/executor.hpp"
55+
#include "asio/executor_work_guard.hpp"
4856
#include "asio/generic/basic_endpoint.hpp"
4957
#include "asio/generic/datagram_protocol.hpp"
5058
#include "asio/generic/raw_protocol.hpp"
@@ -54,10 +62,18 @@
5462
#include "asio/handler_continuation_hook.hpp"
5563
#include "asio/handler_invoke_hook.hpp"
5664
#include "asio/handler_type.hpp"
65+
#include "asio/io_context.hpp"
66+
#include "asio/io_context_strand.hpp"
5767
#include "asio/io_service.hpp"
68+
#include "asio/io_service_strand.hpp"
5869
#include "asio/ip/address.hpp"
5970
#include "asio/ip/address_v4.hpp"
71+
#include "asio/ip/address_v4_iterator.hpp"
72+
#include "asio/ip/address_v4_range.hpp"
6073
#include "asio/ip/address_v6.hpp"
74+
#include "asio/ip/address_v6_iterator.hpp"
75+
#include "asio/ip/address_v6_range.hpp"
76+
#include "asio/ip/bad_address_cast.hpp"
6177
#include "asio/ip/basic_endpoint.hpp"
6278
#include "asio/ip/basic_resolver.hpp"
6379
#include "asio/ip/basic_resolver_entry.hpp"
@@ -66,24 +82,29 @@
6682
#include "asio/ip/host_name.hpp"
6783
#include "asio/ip/icmp.hpp"
6884
#include "asio/ip/multicast.hpp"
85+
#include "asio/ip/resolver_base.hpp"
6986
#include "asio/ip/resolver_query_base.hpp"
7087
#include "asio/ip/resolver_service.hpp"
7188
#include "asio/ip/tcp.hpp"
7289
#include "asio/ip/udp.hpp"
7390
#include "asio/ip/unicast.hpp"
7491
#include "asio/ip/v6_only.hpp"
92+
#include "asio/is_executor.hpp"
7593
#include "asio/is_read_buffered.hpp"
7694
#include "asio/is_write_buffered.hpp"
7795
#include "asio/local/basic_endpoint.hpp"
7896
#include "asio/local/connect_pair.hpp"
7997
#include "asio/local/datagram_protocol.hpp"
8098
#include "asio/local/stream_protocol.hpp"
99+
#include "asio/packaged_task.hpp"
81100
#include "asio/placeholders.hpp"
82101
#include "asio/posix/basic_descriptor.hpp"
83102
#include "asio/posix/basic_stream_descriptor.hpp"
103+
#include "asio/posix/descriptor.hpp"
84104
#include "asio/posix/descriptor_base.hpp"
85105
#include "asio/posix/stream_descriptor.hpp"
86106
#include "asio/posix/stream_descriptor_service.hpp"
107+
#include "asio/post.hpp"
87108
#include "asio/raw_socket_service.hpp"
88109
#include "asio/read.hpp"
89110
#include "asio/read_at.hpp"
@@ -99,9 +120,14 @@
99120
#include "asio/strand.hpp"
100121
#include "asio/stream_socket_service.hpp"
101122
#include "asio/streambuf.hpp"
123+
#include "asio/system_context.hpp"
102124
#include "asio/system_error.hpp"
125+
#include "asio/system_executor.hpp"
103126
#include "asio/thread.hpp"
127+
#include "asio/thread_pool.hpp"
104128
#include "asio/time_traits.hpp"
129+
#include "asio/use_future.hpp"
130+
#include "asio/uses_executor.hpp"
105131
#include "asio/version.hpp"
106132
#include "asio/wait_traits.hpp"
107133
#include "asio/waitable_timer_service.hpp"
@@ -111,6 +137,7 @@
111137
#include "asio/windows/basic_stream_handle.hpp"
112138
#include "asio/windows/object_handle.hpp"
113139
#include "asio/windows/object_handle_service.hpp"
140+
#include "asio/windows/overlapped_handle.hpp"
114141
#include "asio/windows/overlapped_ptr.hpp"
115142
#include "asio/windows/random_access_handle.hpp"
116143
#include "asio/windows/random_access_handle_service.hpp"
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
//
2+
// associated_allocator.hpp
3+
// ~~~~~~~~~~~~~~~~~~~~~~~~
4+
//
5+
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6+
//
7+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9+
//
10+
11+
#ifndef ASIO_ASSOCIATED_ALLOCATOR_HPP
12+
#define ASIO_ASSOCIATED_ALLOCATOR_HPP
13+
14+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15+
# pragma once
16+
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17+
18+
#include "asio/detail/config.hpp"
19+
#include <memory>
20+
#include "asio/detail/type_traits.hpp"
21+
22+
#include "asio/detail/push_options.hpp"
23+
24+
namespace asio {
25+
namespace detail {
26+
27+
template <typename>
28+
struct associated_allocator_check
29+
{
30+
typedef void type;
31+
};
32+
33+
template <typename T, typename E, typename = void>
34+
struct associated_allocator_impl
35+
{
36+
typedef E type;
37+
38+
static type get(const T&, const E& e) ASIO_NOEXCEPT
39+
{
40+
return e;
41+
}
42+
};
43+
44+
template <typename T, typename E>
45+
struct associated_allocator_impl<T, E,
46+
typename associated_allocator_check<typename T::allocator_type>::type>
47+
{
48+
typedef typename T::allocator_type type;
49+
50+
static type get(const T& t, const E&) ASIO_NOEXCEPT
51+
{
52+
return t.get_allocator();
53+
}
54+
};
55+
56+
} // namespace detail
57+
58+
/// Traits type used to obtain the allocator associated with an object.
59+
/**
60+
* A program may specialise this traits type if the @c T template parameter in
61+
* the specialisation is a user-defined type. The template parameter @c
62+
* Allocator shall be a type meeting the Allocator requirements.
63+
*
64+
* Specialisations shall meet the following requirements, where @c t is a const
65+
* reference to an object of type @c T, and @c a is an object of type @c
66+
* Allocator.
67+
*
68+
* @li Provide a nested typedef @c type that identifies a type meeting the
69+
* Allocator requirements.
70+
*
71+
* @li Provide a noexcept static member function named @c get, callable as @c
72+
* get(t) and with return type @c type.
73+
*
74+
* @li Provide a noexcept static member function named @c get, callable as @c
75+
* get(t,a) and with return type @c type.
76+
*/
77+
template <typename T, typename Allocator = std::allocator<void> >
78+
struct associated_allocator
79+
{
80+
/// If @c T has a nested type @c allocator_type, <tt>T::allocator_type</tt>.
81+
/// Otherwise @c Allocator.
82+
#if defined(GENERATING_DOCUMENTATION)
83+
typedef see_below type;
84+
#else // defined(GENERATING_DOCUMENTATION)
85+
typedef typename detail::associated_allocator_impl<T, Allocator>::type type;
86+
#endif // defined(GENERATING_DOCUMENTATION)
87+
88+
/// If @c T has a nested type @c allocator_type, returns
89+
/// <tt>t.get_allocator()</tt>. Otherwise returns @c a.
90+
static type get(const T& t,
91+
const Allocator& a = Allocator()) ASIO_NOEXCEPT
92+
{
93+
return detail::associated_allocator_impl<T, Allocator>::get(t, a);
94+
}
95+
};
96+
97+
/// Helper function to obtain an object's associated allocator.
98+
/**
99+
* @returns <tt>associated_allocator<T>::get(t)</tt>
100+
*/
101+
template <typename T>
102+
inline typename associated_allocator<T>::type
103+
get_associated_allocator(const T& t) ASIO_NOEXCEPT
104+
{
105+
return associated_allocator<T>::get(t);
106+
}
107+
108+
/// Helper function to obtain an object's associated allocator.
109+
/**
110+
* @returns <tt>associated_allocator<T, Allocator>::get(t, a)</tt>
111+
*/
112+
template <typename T, typename Allocator>
113+
inline typename associated_allocator<T, Allocator>::type
114+
get_associated_allocator(const T& t, const Allocator& a) ASIO_NOEXCEPT
115+
{
116+
return associated_allocator<T, Allocator>::get(t, a);
117+
}
118+
119+
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
120+
121+
template <typename T, typename Allocator = std::allocator<void> >
122+
using associated_allocator_t
123+
= typename associated_allocator<T, Allocator>::type;
124+
125+
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
126+
127+
} // namespace asio
128+
129+
#include "asio/detail/pop_options.hpp"
130+
131+
#endif // ASIO_ASSOCIATED_ALLOCATOR_HPP
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
//
2+
// associated_executor.hpp
3+
// ~~~~~~~~~~~~~~~~~~~~~~~
4+
//
5+
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6+
//
7+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9+
//
10+
11+
#ifndef ASIO_ASSOCIATED_EXECUTOR_HPP
12+
#define ASIO_ASSOCIATED_EXECUTOR_HPP
13+
14+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15+
# pragma once
16+
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17+
18+
#include "asio/detail/config.hpp"
19+
#include "asio/detail/type_traits.hpp"
20+
#include "asio/is_executor.hpp"
21+
#include "asio/system_executor.hpp"
22+
23+
#include "asio/detail/push_options.hpp"
24+
25+
namespace asio {
26+
namespace detail {
27+
28+
template <typename>
29+
struct associated_executor_check
30+
{
31+
typedef void type;
32+
};
33+
34+
template <typename T, typename E, typename = void>
35+
struct associated_executor_impl
36+
{
37+
typedef E type;
38+
39+
static type get(const T&, const E& e) ASIO_NOEXCEPT
40+
{
41+
return e;
42+
}
43+
};
44+
45+
template <typename T, typename E>
46+
struct associated_executor_impl<T, E,
47+
typename associated_executor_check<typename T::executor_type>::type>
48+
{
49+
typedef typename T::executor_type type;
50+
51+
static type get(const T& t, const E&) ASIO_NOEXCEPT
52+
{
53+
return t.get_executor();
54+
}
55+
};
56+
57+
} // namespace detail
58+
59+
/// Traits type used to obtain the executor associated with an object.
60+
/**
61+
* A program may specialise this traits type if the @c T template parameter in
62+
* the specialisation is a user-defined type. The template parameter @c
63+
* Executor shall be a type meeting the Executor requirements.
64+
*
65+
* Specialisations shall meet the following requirements, where @c t is a const
66+
* reference to an object of type @c T, and @c e is an object of type @c
67+
* Executor.
68+
*
69+
* @li Provide a nested typedef @c type that identifies a type meeting the
70+
* Executor requirements.
71+
*
72+
* @li Provide a noexcept static member function named @c get, callable as @c
73+
* get(t) and with return type @c type.
74+
*
75+
* @li Provide a noexcept static member function named @c get, callable as @c
76+
* get(t,e) and with return type @c type.
77+
*/
78+
template <typename T, typename Executor = system_executor>
79+
struct associated_executor
80+
{
81+
/// If @c T has a nested type @c executor_type, <tt>T::executor_type</tt>.
82+
/// Otherwise @c Executor.
83+
#if defined(GENERATING_DOCUMENTATION)
84+
typedef see_below type;
85+
#else // defined(GENERATING_DOCUMENTATION)
86+
typedef typename detail::associated_executor_impl<T, Executor>::type type;
87+
#endif // defined(GENERATING_DOCUMENTATION)
88+
89+
/// If @c T has a nested type @c executor_type, returns
90+
/// <tt>t.get_executor()</tt>. Otherwise returns @c ex.
91+
static type get(const T& t,
92+
const Executor& ex = Executor()) ASIO_NOEXCEPT
93+
{
94+
return detail::associated_executor_impl<T, Executor>::get(t, ex);
95+
}
96+
};
97+
98+
/// Helper function to obtain an object's associated executor.
99+
/**
100+
* @returns <tt>associated_executor<T>::get(t)</tt>
101+
*/
102+
template <typename T>
103+
inline typename associated_executor<T>::type
104+
get_associated_executor(const T& t) ASIO_NOEXCEPT
105+
{
106+
return associated_executor<T>::get(t);
107+
}
108+
109+
/// Helper function to obtain an object's associated executor.
110+
/**
111+
* @returns <tt>associated_executor<T, Executor>::get(t, ex)</tt>
112+
*/
113+
template <typename T, typename Executor>
114+
inline typename associated_executor<T, Executor>::type
115+
get_associated_executor(const T& t, const Executor& ex,
116+
typename enable_if<is_executor<
117+
Executor>::value>::type* = 0) ASIO_NOEXCEPT
118+
{
119+
return associated_executor<T, Executor>::get(t, ex);
120+
}
121+
122+
/// Helper function to obtain an object's associated executor.
123+
/**
124+
* @returns <tt>associated_executor<T, typename
125+
* ExecutionContext::executor_type>::get(t, ctx.get_executor())</tt>
126+
*/
127+
template <typename T, typename ExecutionContext>
128+
inline typename associated_executor<T,
129+
typename ExecutionContext::executor_type>::type
130+
get_associated_executor(const T& t, ExecutionContext& ctx,
131+
typename enable_if<is_convertible<ExecutionContext&,
132+
execution_context&>::value>::type* = 0) ASIO_NOEXCEPT
133+
{
134+
return associated_executor<T,
135+
typename ExecutionContext::executor_type>::get(t, ctx.get_executor());
136+
}
137+
138+
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
139+
140+
template <typename T, typename Executor = system_executor>
141+
using associated_executor_t = typename associated_executor<T, Executor>::type;
142+
143+
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
144+
145+
} // namespace asio
146+
147+
#include "asio/detail/pop_options.hpp"
148+
149+
#endif // ASIO_ASSOCIATED_EXECUTOR_HPP

0 commit comments

Comments
 (0)