Skip to content

Commit b60e92b

Browse files
committed
Initial merge of Networking TS compatibility.
Merged from chriskohlhoff/asio master branch as of commit 4a4d28b.
1 parent b002097 commit b60e92b

File tree

617 files changed

+43295
-21609
lines changed

Some content is hidden

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

617 files changed

+43295
-21609
lines changed

doc/asio.qbk

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
]
2121

2222
[template mdash[] '''— ''']
23-
[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
24-
[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
23+
[template half_open_range[text] '''&#91;'''[text])]
24+
[template indexterm1[id term1] '''<indexterm id="'''[id]'''"><primary>'''[term1]'''</primary></indexterm>''']
25+
[template indexterm2[id term1 term2] '''<indexterm id="'''[id]'''"><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
26+
[template inline_note[text] \[['Note:] [text] '''&mdash;'''['end note]\] ]
2527
[template ticket[number]'''<ulink url="https://svn.boost.org/trac/boost/ticket/'''[number]'''">'''#[number]'''</ulink>''']
2628
[def __POSIX__ /POSIX/]
2729
[def __Windows__ /Windows/]
@@ -31,9 +33,11 @@
3133
[def __getsockname__ [@http://www.opengroup.org/onlinepubs/000095399/functions/getsockname.html `getsockname()`]]
3234
[def __getsockopt__ [@http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html `getsockopt()`]]
3335
[def __ioctl__ [@http://www.opengroup.org/onlinepubs/000095399/functions/ioctl.html `ioctl()`]]
36+
[def __poll__ [@http://www.opengroup.org/onlinepubs/000095399/functions/poll.html `poll()`]]
3437
[def __recvfrom__ [@http://www.opengroup.org/onlinepubs/000095399/functions/recvfrom.html `recvfrom()`]]
3538
[def __sendto__ [@http://www.opengroup.org/onlinepubs/000095399/functions/sendto.html `sendto()`]]
3639
[def __setsockopt__ [@http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html `setsockopt()`]]
40+
[def __shutdown__ [@http://www.opengroup.org/onlinepubs/000095399/functions/shutdown.html `shutdown()`]]
3741
[def __socket__ [@http://www.opengroup.org/onlinepubs/000095399/functions/socket.html `socket()`]]
3842

3943
[/=============================================================================]

doc/examples.qbk

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ cancelling all outstanding asynchronous operations.
116116

117117
[heading HTTP Server 2]
118118

119-
An HTTP server using an io_service-per-CPU design.
119+
An HTTP server using an io_context-per-CPU design.
120120

121121
* [@boost_asio/example/cpp03/http/server2/connection.cpp]
122122
* [@boost_asio/example/cpp03/http/server2/connection.hpp]
123123
* [@boost_asio/example/cpp03/http/server2/header.hpp]
124-
* [@boost_asio/example/cpp03/http/server2/io_service_pool.cpp]
125-
* [@boost_asio/example/cpp03/http/server2/io_service_pool.hpp]
124+
* [@boost_asio/example/cpp03/http/server2/io_context_pool.cpp]
125+
* [@boost_asio/example/cpp03/http/server2/io_context_pool.hpp]
126126
* [@boost_asio/example/cpp03/http/server2/main.cpp]
127127
* [@boost_asio/example/cpp03/http/server2/mime_types.cpp]
128128
* [@boost_asio/example/cpp03/http/server2/mime_types.hpp]
@@ -139,7 +139,7 @@ An HTTP server using an io_service-per-CPU design.
139139

140140
[heading HTTP Server 3]
141141

142-
An HTTP server using a single io_service and a thread pool calling `io_service::run()`.
142+
An HTTP server using a single io_context and a thread pool calling `io_context::run()`.
143143

144144
* [@boost_asio/example/cpp03/http/server3/connection.cpp]
145145
* [@boost_asio/example/cpp03/http/server3/connection.hpp]
@@ -227,7 +227,7 @@ decode structures for transmission over a socket.
227227
[heading Services]
228228

229229
This example demonstrates how to integrate custom functionality (in this case,
230-
for logging) into asio's [link boost_asio.reference.io_service io_service], and
230+
for logging) into asio's [link boost_asio.reference.io_context io_context], and
231231
how to use a custom service with [link
232232
boost_asio.reference.basic_stream_socket basic_stream_socket<>].
233233

doc/overview/async.qbk

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ read or write on a socket.]
3030
[mdash] Asynchronous Operation Processor
3131

3232
[:Executes asynchronous operations and queues events on a completion event
33-
queue when operations complete. From a high-level point of view, services like
34-
`stream_socket_service` are asynchronous operation processors.]
33+
queue when operations complete. From a high-level point of view, internal
34+
services like `reactive_socket_service` are asynchronous operation processors.]
3535

3636
[mdash] Completion Event Queue
3737

@@ -52,14 +52,14 @@ a completed event to its caller.]
5252

5353
[:Calls the asynchronous event demultiplexer to dequeue events, and dispatches
5454
the completion handler (i.e. invokes the function object) associated with the
55-
event. This abstraction is represented by the `io_service` class.]
55+
event. This abstraction is represented by the `io_context` class.]
5656

5757
[mdash] Initiator
5858

5959
[:Application-specific code that starts asynchronous operations. The initiator
6060
interacts with an asynchronous operation processor via a high-level interface
6161
such as `basic_stream_socket`, which in turn delegates to a service like
62-
`stream_socket_service`.]
62+
`reactive_socket_service`.]
6363

6464
[heading Implementation Using Reactor]
6565

@@ -97,7 +97,7 @@ calling an overlapped function such as `AcceptEx`.]
9797
[mdash] Completion Event Queue
9898

9999
[:This is implemented by the operating system, and is associated with an I/O
100-
completion port. There is one I/O completion port for each `io_service`
100+
completion port. There is one I/O completion port for each `io_context`
101101
instance.]
102102

103103
[mdash] Asynchronous Event Demultiplexer

doc/overview/basics.qbk

+14-14
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ operations.
1717

1818
[$boost_asio/sync_op.png]
1919

20-
[*Your program] will have at least one [*io_service] object. The [*io_service]
20+
[*Your program] will have at least one [*io_context] object. The [*io_context]
2121
represents [*your program]'s link to the [*operating system]'s I/O services.
2222

23-
boost::asio::io_service io_service;
23+
boost::asio::io_context io_context;
2424

2525
To perform I/O operations [*your program] will need an [*I/O object] such as a
2626
TCP socket:
2727

28-
boost::asio::ip::tcp::socket socket(io_service);
28+
boost::asio::ip::tcp::socket socket(io_context);
2929

3030
When a synchronous connect operation is performed, the following sequence of
3131
events occurs:
@@ -35,15 +35,15 @@ object]:
3535

3636
socket.connect(server_endpoint);
3737

38-
2. The [*I/O object] forwards the request to the [*io_service].
38+
2. The [*I/O object] forwards the request to the [*io_context].
3939

40-
3. The [*io_service] calls on the [*operating system] to perform the connect
40+
3. The [*io_context] calls on the [*operating system] to perform the connect
4141
operation.
4242

4343
4. The [*operating system] returns the result of the operation to the
44-
[*io_service].
44+
[*io_context].
4545

46-
5. The [*io_service] translates any error resulting from the operation into an
46+
5. The [*io_context] translates any error resulting from the operation into an
4747
object of type `boost::system::error_code`. An `error_code` may be compared with
4848
specific values, or tested as a boolean (where a `false` result means that no
4949
error occurred). The result is then forwarded back up to the [*I/O object].
@@ -76,9 +76,9 @@ The exact signature required depends on the asynchronous operation being
7676
performed. The reference documentation indicates the appropriate form for each
7777
operation.
7878

79-
2. The [*I/O object] forwards the request to the [*io_service].
79+
2. The [*I/O object] forwards the request to the [*io_context].
8080

81-
3. The [*io_service] signals to the [*operating system] that it should start an
81+
3. The [*io_context] signals to the [*operating system] that it should start an
8282
asynchronous connect.
8383

8484
Time passes. (In the synchronous case this wait would have been contained
@@ -87,15 +87,15 @@ entirely within the duration of the connect operation.)
8787
[$boost_asio/async_op2.png]
8888

8989
4. The [*operating system] indicates that the connect operation has completed
90-
by placing the result on a queue, ready to be picked up by the [*io_service].
90+
by placing the result on a queue, ready to be picked up by the [*io_context].
9191

92-
5. [*Your program] must make a call to `io_service::run()` (or to one of the
93-
similar [*io_service] member functions) in order for the result to be
94-
retrieved. A call to `io_service::run()` blocks while there are unfinished
92+
5. [*Your program] must make a call to `io_context::run()` (or to one of the
93+
similar [*io_context] member functions) in order for the result to be
94+
retrieved. A call to `io_context::run()` blocks while there are unfinished
9595
asynchronous operations, so you would typically call it as soon as you have
9696
started your first asynchronous operation.
9797

98-
6. While inside the call to `io_service::run()`, the [*io_service] dequeues the
98+
6. While inside the call to `io_context::run()`, the [*io_context] dequeues the
9999
result of the operation, translates it into an `error_code`, and then passes it
100100
to [*your completion handler].
101101

doc/overview/bsd_sockets.qbk

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ The following table shows the mapping between the BSD socket API and Boost.Asio:
166166
[`poll()`,
167167
`select()`,
168168
`pselect()`]
169-
[ [link boost_asio.reference.io_service.run io_service::run()],
170-
[link boost_asio.reference.io_service.run_one io_service::run_one()],
171-
[link boost_asio.reference.io_service.poll io_service::poll()],
172-
[link boost_asio.reference.io_service.poll_one io_service::poll_one()]
169+
[ [link boost_asio.reference.io_context.run io_context::run()],
170+
[link boost_asio.reference.io_context.run_one io_context::run_one()],
171+
[link boost_asio.reference.io_context.poll io_context::poll()],
172+
[link boost_asio.reference.io_context.poll_one io_context::poll_one()]
173173

174174
Note: in conjunction with asynchronous operations. ]
175175
]

doc/overview/buffers.qbk

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ an opaque representation of contiguous memory, where:
4545
mechanisms for automatically determining the size of a buffer from an array,
4646
`boost::array` or `std::vector` of POD elements, or from a `std::string`.
4747

48-
* Type safety violations must be explicitly requested using the `buffer_cast`
48+
* The underlying memory is explicitly accessed using the `data()` member
4949
function. In general an application should never need to do this, but it is
5050
required by the library implementation to pass the raw memory to the
5151
underlying operating system functions.

doc/overview/cpp2011.qbk

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Windows handles.
3333

3434
Move support allows you to write code like:
3535

36-
tcp::socket make_socket(io_service& i)
36+
tcp::socket make_socket(io_context& i)
3737
{
3838
tcp::socket s(i);
3939
...

doc/overview/handler_tracking.qbk

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The `<action>` takes one of the following forms:
6767
[~n]
6868
[The handler number `n` was destroyed without having been invoked. This is
6969
usually the case for any unfinished asynchronous operations when the
70-
`io_service` is destroyed.]
70+
`io_context` is destroyed.]
7171
]
7272
[
7373
[n*m]

doc/overview/implementation.qbk

+40-40
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
2222
Threads:
2323

2424
* Demultiplexing using `select` is performed in one of the threads that calls
25-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
26-
`io_service::poll_one()`.
25+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
26+
`io_context::poll_one()`.
2727

28-
* An additional thread per `io_service` is used to emulate asynchronous host
28+
* An additional thread per `io_context` is used to emulate asynchronous host
2929
resolution. This thread is created on the first call to either
3030
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
3131

@@ -42,10 +42,10 @@ Demultiplexing mechanism:
4242
Threads:
4343

4444
* Demultiplexing using `epoll` is performed in one of the threads that calls
45-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
46-
`io_service::poll_one()`.
45+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
46+
`io_context::poll_one()`.
4747

48-
* An additional thread per `io_service` is used to emulate asynchronous host
48+
* An additional thread per `io_context` is used to emulate asynchronous host
4949
resolution. This thread is created on the first call to either
5050
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
5151

@@ -63,10 +63,10 @@ Demultiplexing mechanism:
6363
Threads:
6464

6565
* Demultiplexing using [^/dev/poll] is performed in one of the threads that
66-
calls `io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
67-
`io_service::poll_one()`.
66+
calls `io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
67+
`io_context::poll_one()`.
6868

69-
* An additional thread per `io_service` is used to emulate asynchronous host
69+
* An additional thread per `io_context` is used to emulate asynchronous host
7070
resolution. This thread is created on the first call to either
7171
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
7272

@@ -85,10 +85,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
8585
Threads:
8686

8787
* Demultiplexing using `select` is performed in one of the threads that calls
88-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
89-
`io_service::poll_one()`.
88+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
89+
`io_context::poll_one()`.
9090

91-
* An additional thread per `io_service` is used to emulate asynchronous host
91+
* An additional thread per `io_context` is used to emulate asynchronous host
9292
resolution. This thread is created on the first call to either
9393
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
9494

@@ -106,10 +106,10 @@ Demultiplexing mechanism:
106106
Threads:
107107

108108
* Demultiplexing using `kqueue` is performed in one of the threads that calls
109-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
110-
`io_service::poll_one()`.
109+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
110+
`io_context::poll_one()`.
111111

112-
* An additional thread per `io_service` is used to emulate asynchronous host
112+
* An additional thread per `io_context` is used to emulate asynchronous host
113113
resolution. This thread is created on the first call to either
114114
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
115115

@@ -127,10 +127,10 @@ Demultiplexing mechanism:
127127
Threads:
128128

129129
* Demultiplexing using `kqueue` is performed in one of the threads that calls
130-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
131-
`io_service::poll_one()`.
130+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
131+
`io_context::poll_one()`.
132132

133-
* An additional thread per `io_service` is used to emulate asynchronous host
133+
* An additional thread per `io_context` is used to emulate asynchronous host
134134
resolution. This thread is created on the first call to either
135135
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
136136

@@ -149,10 +149,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
149149
Threads:
150150

151151
* Demultiplexing using `select` is performed in one of the threads that calls
152-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
153-
`io_service::poll_one()`.
152+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
153+
`io_context::poll_one()`.
154154

155-
* An additional thread per `io_service` is used to emulate asynchronous host
155+
* An additional thread per `io_context` is used to emulate asynchronous host
156156
resolution. This thread is created on the first call to either
157157
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
158158

@@ -171,10 +171,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
171171
Threads:
172172

173173
* Demultiplexing using `select` is performed in one of the threads that calls
174-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
175-
`io_service::poll_one()`.
174+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
175+
`io_context::poll_one()`.
176176

177-
* An additional thread per `io_service` is used to emulate asynchronous host
177+
* An additional thread per `io_context` is used to emulate asynchronous host
178178
resolution. This thread is created on the first call to either
179179
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
180180

@@ -193,10 +193,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
193193
Threads:
194194

195195
* Demultiplexing using `select` is performed in one of the threads that calls
196-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
197-
`io_service::poll_one()`.
196+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
197+
`io_context::poll_one()`.
198198

199-
* An additional thread per `io_service` is used to emulate asynchronous host
199+
* An additional thread per `io_context` is used to emulate asynchronous host
200200
resolution. This thread is created on the first call to either
201201
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
202202

@@ -214,10 +214,10 @@ Demultiplexing mechanism:
214214
Threads:
215215

216216
* Demultiplexing using `select` is performed in one of the threads that calls
217-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
218-
`io_service::poll_one()`.
217+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
218+
`io_context::poll_one()`.
219219

220-
* An additional thread per `io_service` is used to emulate asynchronous host
220+
* An additional thread per `io_context` is used to emulate asynchronous host
221221
resolution. This thread is created on the first call to either
222222
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
223223

@@ -238,17 +238,17 @@ operations except for asynchronous connect.
238238
Threads:
239239

240240
* Demultiplexing using I/O completion ports is performed in all threads that call
241-
`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
242-
`io_service::poll_one()`.
241+
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
242+
`io_context::poll_one()`.
243243

244-
* An additional thread per `io_service` is used to trigger timers. This thread
245-
is created on construction of the first `deadline_timer` or
246-
`deadline_timer_service` objects.
244+
* An additional thread per `io_context` is used to trigger timers. This thread
245+
is created on construction of the first `basic_deadline_timer` or
246+
`basic_waitable_timer` objects.
247247

248-
* An additional thread per `io_service` is used for the `select`
248+
* An additional thread per `io_context` is used for the `select`
249249
demultiplexing. This thread is created on the first call to `async_connect()`.
250250

251-
* An additional thread per `io_service` is used to emulate asynchronous host
251+
* An additional thread per `io_context` is used to emulate asynchronous host
252252
resolution. This thread is created on the first call to either
253253
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
254254

@@ -265,7 +265,7 @@ Boost.Asio provides limited support for the Windows Runtime. It requires that th
265265
language extensions be enabled. Due to the restricted facilities exposed by the
266266
Windows Runtime API, the support comes with the following caveats:
267267

268-
* The core facilities such as the `io_service`, `strand`, buffers, composed
268+
* The core facilities such as the `io_context`, `strand`, buffers, composed
269269
operations, timers, etc., should all work as normal.
270270

271271
* For sockets, only client-side TCP is supported.
@@ -292,9 +292,9 @@ Demultiplexing mechanism:
292292
Threads:
293293

294294
* Event completions are delivered to the Windows thread pool and posted to the
295-
`io_service` for the handler to be executed.
295+
`io_context` for the handler to be executed.
296296

297-
* An additional thread per `io_service` is used to trigger timers. This thread
297+
* An additional thread per `io_context` is used to trigger timers. This thread
298298
is created on construction of the first timer objects.
299299

300300
Scatter-Gather:

0 commit comments

Comments
 (0)