2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-27 06:32:08 +00:00
Commit Graph

1473 Commits

Author SHA1 Message Date
Christopher Kohlhoff
fc6400a1ef Restore null pointer check for better performance. 2020-11-02 14:03:10 +11:00
Christopher Kohlhoff
18d17285c3 Enable UNIX domain sockets for Windows.
From Windows 10, UNIX domain sockets (a.k.a "local" sockets) are
supported on Windows, with the exception of the connect_pair
function (which will fail with an operation_not_supported error).
2020-11-02 14:03:10 +11:00
Christopher Kohlhoff
129b70bec5 Fix name of std_event::unlock_and_signal_one_for_destruction(). 2020-11-02 14:03:10 +11:00
Christopher Kohlhoff
e323bca413 Fix error_code assign() in inet_pton emulation for WinRT. 2020-11-02 14:03:10 +11:00
Christopher Kohlhoff
eb1f1131c1 Add executor-converting construction/assignment to ip::basic_resolver. 2020-11-02 14:03:10 +11:00
Christopher Kohlhoff
311d355ab4 Add experimental::as_single completion token adapter.
The as_single completion token adapter can be used to specify that the
completion handler arguments should be combined into a single argument.
For completion signatures with a single parameter, the argument is
passed through as-is. For signatures with two or more parameters, the
arguments are combined into a tuple.

The as_single adapter may be used in conjunction with use_awaitable and
structured bindings as follows:

    auto [e, n] = co_await socket.async_read_some(
        boost::asio::buffer(data), as_single(use_awaitable));

Alternatively, it may be used as a default completion token like so:

    using default_token = as_single_t<use_awaitable_t<>>;
    using tcp_socket = default_token::as_default_on_t<tcp::socket>;
    // ...
    awaitable<void> do_read(tcp_socket socket)
    {
      // ...
      auto [e, n] = co_await socket.async_read_some(boost::asio::buffer(data));
      // ...
    }
2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
c034e3906f Clarify when the select reactor is used on Windows. 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
53211fce62 Use _POSIX_VERSION to detect support for MSG_NOSIGNAL.
This flag for sendmsg(2) was standardised in POSIX.1-2008 so all systems
that support at least that version should have it. This prevents
unexpected SIGPIPEs on at least OpenBSD and possibly others.
MSG_NOSIGNAL is used unconditionally on Linux to match existing
behaviour and also because this was present on Linux long before
standardisation.
2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
f5e8ecdcba Allow using libpthread on Windows.
In some cases, using libpthread on Windows is desired, for example
when porting software that's already using libpthread, avoiding
mixing the two libraries, which can be troublesome.

This change will allow using libthread when targetting Windows and
BOOST_ASIO_HAS_PTHREADS is set.
2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
aba1c59418 Fix typo GENERATION_DOCUMENTATION 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
c9a6942cd4 Qualify a call to this_ to satisfy clang on Windows.
Without this change, clang 10.0.0 (and at least as early as 8.0.0)
fails to compile asio on Windows.
2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
b2b0f19544 Reduce lock contention for cancel_timer.
Lock should not be held while executing post_deferred_completions.
The unlock call is present everywhere (in all implementations, including in this file) except in this function.
Lock contention has been observed via Windows Performance Analyzer:

ntdll.dll!RtlpWaitOnCriticalSection
ntdll.dll!RtlpEnterCriticalSectionContended
ntdll.dll!RtlEnterCriticalSection
IxServer.exe!boost::asio::detail::win_iocp_io_context::cancel_timer<boost::asio::detail::chrono_time_traits<boost::chrono::steady_clock,boost::asio::wait_traits<boost::chrono::steady_clock> > >
IxServer.exe!boost::asio::detail::deadline_timer_service<boost::asio::detail::chrono_time_traits<boost::chrono::steady_clock,boost::asio::wait_traits<boost::chrono::steady_clock> > >::expires_at
2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
fc4546c8d3 Fix thread_pool test to work with BOOST_ASIO_NO_TYPEID (i.e. no RTTI). 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
553b805626 Fix any_executor support for BOOST_ASIO_NO_TYPEID (i.e. no RTTI). 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
898f838331 Cast to void to fix comma-operator warning. 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
616bff3f0f Remove redundant semicolons. 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
4f7fd78953 Suppress zero-as-null-pointer-constant warnings. 2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
b1c6407e3d Add missing push/pop_options.hpp includes. 2020-11-02 12:24:13 +11:00
Christopher Kohlhoff
8e1d80d8b9 Fix (benign) switch fallthrough warning. 2020-11-02 12:23:57 +11:00
Christopher Kohlhoff
883e66e3c4 Fix "logical ‘or’ of equal expressions" warning on linux. 2020-11-02 12:23:45 +11:00
Christopher Kohlhoff
1cf0a9bf14 Fix shadow name warnings caused by addition of asio::query. 2020-11-02 12:23:26 +11:00
Christopher Kohlhoff
cec733bd5c Ensure executor concept tests for const-qualified execute(). 2020-11-02 12:23:08 +11:00
Christopher Kohlhoff
b3c8f8ed5e Revert "Restore null pointer check for better performance."
This reverts commit 50b38b57e6. This
change was applied in the wrong spot and introduced an uninitialised
memory access. The corresponding entry in the Revision History has
also been removed.
2020-08-11 09:33:07 +10:00
Christopher Kohlhoff
52a2f2ac59 Version bump. 2020-08-05 23:13:10 +10:00
Christopher Kohlhoff
fd68805a3f Update revision history. 2020-08-05 23:13:10 +10:00
Christopher Kohlhoff
2a0773e1e0 Add some basic documentation on standard executors support. 2020-08-05 23:13:10 +10:00
Christopher Kohlhoff
18deb3dc5f Document that there are multiple types of I/O execution context. 2020-08-05 22:54:41 +10:00
Christopher Kohlhoff
917e05ceb3 Clarify impact of any_io_executor change. 2020-08-05 22:51:20 +10:00
Christopher Kohlhoff
06f8c1f98d Add shape_type and index_type to static_thread_pool executor, as per specification. 2020-08-04 12:52:40 +10:00
Christopher Kohlhoff
2f93fdb0c7 Prevent target-acquiring adapter constructors from being considered during overload resolution for conversion. 2020-08-01 11:25:31 +10:00
Christopher Kohlhoff
50b38b57e6 Restore null pointer check for better performance. 2020-08-01 11:24:36 +10:00
Christopher Kohlhoff
517e25cdcb Ensure concept-related traits work with void. 2020-07-31 18:47:51 +10:00
Christopher Kohlhoff
e53feeb5bf Add constraints to strand<>'s constructor to prevent template instantiation recursion. 2020-07-31 18:47:27 +10:00
Christopher Kohlhoff
0ccf4662cc Use constraints on any_executor's converting constructors, as per the specification. 2020-07-31 18:43:49 +10:00
Christopher Kohlhoff
e0cb6b1c11 Add short-circuiting to traits evaluation.
Test first for well-formed CPO expressions (or, in the case of senders,
a specialised sender_traits template) and, if not valid, short-circuit
the remainder of the traits evaluation. This helps prevent recursive
template instantiations that can occur in some contexts.
2020-07-31 18:43:38 +10:00
Christopher Kohlhoff
bbbda48bfb Mark constructors in synopses for nested classes and classes in sub-namespaces. 2020-07-30 10:40:56 +10:00
Christopher Kohlhoff
543c453423 Make blocking_t::always_t::is_preferable false as per specification. 2020-07-28 22:16:24 +10:00
Christopher Kohlhoff
db0d05de01 Fix typos. 2020-07-28 22:14:03 +10:00
Christopher Kohlhoff
bfdf118094 Fix reference to asio::query customisation point. 2020-07-28 22:12:31 +10:00
Christopher Kohlhoff
7ddf71b69b Exclude I/O objects' impl_ data members from documentation. 2020-07-28 22:10:58 +10:00
Christopher Kohlhoff
680130daf2 Mark constructors/destructors in class synopses. 2020-07-28 22:09:10 +10:00
Christopher Kohlhoff
7d3c889c60 Mark static members in class synopses. 2020-07-28 22:07:38 +10:00
Christopher Kohlhoff
3ee1087d1c Add detailed descriptions for standard executor-related member functions. 2020-07-27 09:37:15 +10:00
Christopher Kohlhoff
87d0d486f2 Documentation generation tweaks. 2020-07-27 09:34:51 +10:00
Christopher Kohlhoff
60532356ff Fix up trait specialisations for use_future's executor. 2020-07-27 09:34:18 +10:00
Christopher Kohlhoff
2b200181e8 Fix executor_type definition in async_compose implementation. 2020-07-27 09:34:04 +10:00
Christopher Kohlhoff
badd16b2ff Fix detection of standard executors as I/O executors in async_compose. 2020-07-27 09:33:49 +10:00
Christopher Kohlhoff
55a6f4aefe Add workaround for coroutine argument capture problem in gcc 10. 2020-07-25 01:02:39 +10:00
Christopher Kohlhoff
6df0fc4e47 Fix typo in forward declaration of any_io_executor. 2020-07-25 01:02:23 +10:00
Christopher Kohlhoff
aa5a315a14 Add missing definition of BOOST_ASIO_EXECUTION_RECEIVER_OF_n macros. 2020-07-23 21:54:56 +10:00