summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/src/doc/overview/reactor.qbk
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/src/doc/overview/reactor.qbk')
-rw-r--r--3rdparty/asio/src/doc/overview/reactor.qbk44
1 files changed, 44 insertions, 0 deletions
diff --git a/3rdparty/asio/src/doc/overview/reactor.qbk b/3rdparty/asio/src/doc/overview/reactor.qbk
new file mode 100644
index 00000000000..468645ad4c0
--- /dev/null
+++ b/3rdparty/asio/src/doc/overview/reactor.qbk
@@ -0,0 +1,44 @@
+[/
+ / Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+ /
+ / Distributed under the Boost Software License, Version 1.0. (See accompanying
+ / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ /]
+
+[section:reactor Reactor-Style Operations]
+
+Sometimes a program must be integrated with a third-party library that wants to
+perform the I/O operations itself. To facilitate this, Asio includes
+synchronous and asynchronous operations that may be used to wait for a socket
+to become ready to read, ready to write, or to have a pending error condition.
+
+As an example, to perform a non-blocking read something like the following may
+be used:
+
+ ip::tcp::socket socket(my_io_context);
+ ...
+ socket.non_blocking(true);
+ ...
+ socket.async_wait(ip::tcp::socket::wait_read, read_handler);
+ ...
+ void read_handler(asio::error_code ec)
+ {
+ if (!ec)
+ {
+ std::vector<char> buf(socket.available());
+ socket.read_some(buffer(buf));
+ }
+ }
+
+These operations are supported for sockets on all platforms, and for the POSIX
+stream-oriented descriptor classes.
+
+[heading See Also]
+
+[link asio.reference.basic_socket.wait basic_socket::wait()],
+[link asio.reference.basic_socket.async_wait basic_socket::async_wait()],
+[link asio.reference.basic_socket.non_blocking basic_socket::non_blocking()],
+[link asio.reference.basic_socket.native_non_blocking basic_socket::native_non_blocking()],
+[link asio.examples.cpp03_examples.nonblocking nonblocking example].
+
+[endsect]