2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-29 19:12:09 +00:00
Commit Graph

1152 Commits

Author SHA1 Message Date
Christopher Kohlhoff
d2b7968df4 Use associator trait in async_read_at implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
a9497b28f3 Use associator trait in async_read implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
60bd44c3f9 Use associator trait in detail::bind_handler implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
41f180f052 Use associator trait in redirect_error implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
793f6e25e3 Use associator trait in experimental::as_single implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
3bef12eea4 Use associator trait in bind_executor implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
e618857ff3 Add associator trait.
The associator trait is used to generically forward associators, such as
associated_executor<> and associated_allocator<>, through intermediate
completion handlers. For example:

    template <typename Handler>
    struct intermediate_handler
    {
      Handler handler_;

      template <typename... Args>
      void operator()(Args&... args)
      {
        // ...
      }
    };

    namespace boost {
    namespace asio {

      template <
          template <typename, typename> class Associator,
          typename Handler,
          typename DefaultCandidate>
      struct associator<
          Associator,
          intermediate_handler<Handler>,
          DefaultCandidate>
      {
        using type =
          typename Associator<Handler, DefaultCandidate>::type;

        static type get(
            const intermediate_handler<Handler>& h,
            const DefaultCandidate& c = DefaultCandidate()) noexcept
        {
          return Associator<Handler, DefaultCandidate>::get(
              h.handler_, c);
        }
      };

    } // namespace asio
    } // namespace boost
2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
9dfb1ab677 Ensure reactor headers include their dependencies. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
a3b94b6760 Use memset rather than assignment to fill UNIX domain addresses with NULs. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
8df5d67906 Initialise strings used for reverse name resolution. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
8a81ff990a Apply nodiscard attribute to awaitable<>. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
26d1132d3d Increase number of cached memory slots for default recycling allocator.
The number of per-thread slots may be configured at compile time by
defining ASIO_RECYCLING_ALLOCATOR_CACHE_SIZE to a non-negative integer.
If not defined, the default recycling allocator uses two slots.
2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
bb8b2e2832 Make allocators respect alignment requirements.
This is important when completion handlers contain over-aligned members,
for example when captured in a lambda.

This uses operator new() with alignment support if available,
and falls back to Boost Align (again, if available).
2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
1bad8e0dba Add associated_executor and associated_allocator specialisations for std::reference_wrapper. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
1b161b5d91 Add constraints to use_awaitable_t::executor_with_default's constructor to prevent template instantiation recursion. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
93fa0b53dd Fix any_io_executor equality operators. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
558aeb8ea8 Version bump. 2021-04-07 17:32:29 +10:00
Christopher Kohlhoff
6bd1e1932a Prevent blocking.always from being used with strand<>.
Previously, calling `require(E, blocking.always)` on a strand E compiled
but produced incorrect behaviour. Now, `require(E, blocking.always)`
will no longer compile. Furthermore, when used with an always-blocking
inner executor, the strand will report its blocking property as
blocking.possibly.
2021-04-06 19:22:59 +10:00
Christopher Kohlhoff
cfce966532 Fix detection of defaulted template arguments on functions with MSVC. 2021-04-06 19:20:24 +10:00
Christopher Kohlhoff
c77f3b603b Compatibility with boost regex v5. 2021-03-15 11:25:28 +11:00
Christopher Kohlhoff
3e88870e34 Exclude any_io_executor traits from documentation. 2021-03-04 15:45:56 +11:00
Christopher Kohlhoff
3be4dad057 Use separate SFINAE constraints for read_until and async_read_until. 2021-03-04 09:49:09 +11:00
Christopher Kohlhoff
6d9a45f5ce Use separate SFINAE constraints for write and async_write. 2021-03-04 09:48:57 +11:00
Christopher Kohlhoff
03a649f720 Use separate SFINAE constraints for read and async_read. 2021-03-04 09:48:44 +11:00
Christopher Kohlhoff
96a88465fc Use constraint<> rather than enable_if<> in public SFINAE-constrained functions. 2021-03-04 08:48:08 +11:00
Christopher Kohlhoff
739109cacb The executor must be copied when an I/O object is move-assigned.
The moved-from I/O object needs to be left in the same state as if
constructed with a valid executor but without a resource.
2021-03-04 08:47:58 +11:00
Christopher Kohlhoff
c002284dd8 Ensure call_stacks are accessed only from implementation files. 2021-03-04 08:47:45 +11:00
Christopher Kohlhoff
7f0b42653d Change any_io_executor to a 'strong typedef'-style class. 2021-02-25 08:37:47 +11:00
Christopher Kohlhoff
dc6e5669aa Remove deprecated file 'asio/impl/src.cpp'. 2021-02-25 08:37:47 +11:00
Christopher Kohlhoff
0b0b904883 Add std::hash specialisations for ip::basic_endpoint<>. 2021-02-25 08:37:47 +11:00
Christopher Kohlhoff
eed38fbe97 Add std::hash specialisations for IP addresses. 2021-02-25 08:35:32 +11:00
Christopher Kohlhoff
0182813698 Add ip::port_type type alias. 2021-02-25 08:33:48 +11:00
Christopher Kohlhoff
6106cd16d0 Add ip::scope_id_type type alias. 2021-02-25 08:33:38 +11:00
Christopher Kohlhoff
2c50cd1e42 Fix outstanding_work.tracked executor move assignment.
Move assignments for io_context and thread pool executors are missing
the logic present in copy assignments that finishes work on old contexts.
This causes the following example to hang:

int main()
{
    asio::static_thread_pool tp1{1},tp2{1};
    {
        auto work = asio::prefer(tp1.get_executor(),
            asio::execution::outstanding_work.tracked);
        work = asio::prefer(tp2.get_executor(),
            asio::execution::outstanding_work.tracked);
    }
    tp1.join();
    tp2.join();
}
2021-02-25 08:33:25 +11:00
Christopher Kohlhoff
be68fe37ed Make the thread_pool executor's execute, require, and query members private. 2021-02-25 08:33:12 +11:00
Christopher Kohlhoff
9f8835ee02 Make system_executor's execute, require, and query members private. 2021-02-25 08:33:00 +11:00
Christopher Kohlhoff
a820249201 Make the io_context executor's execute, require, and query functions private. 2021-02-25 08:32:51 +11:00
Christopher Kohlhoff
f2b56c196d Add friendship support to execution::occupancy property. 2021-02-25 08:32:40 +11:00
Christopher Kohlhoff
155649a89b Add friendship support to execution::context_as property. 2021-02-25 08:32:29 +11:00
Christopher Kohlhoff
083906c1a2 Add friendship support to execution::context property. 2021-02-25 08:32:18 +11:00
Christopher Kohlhoff
18964b65d5 Add friendship support to execution::allocator property. 2021-02-25 08:32:10 +11:00
Christopher Kohlhoff
6453f488f2 Add friendship support to execution::relationship property. 2021-02-25 08:32:01 +11:00
Christopher Kohlhoff
7b4fd3e040 Add friendship support to execution::outstanding_work property. 2021-02-25 08:31:52 +11:00
Christopher Kohlhoff
6d0058eeea Add friendship support to execution::mapping property. 2021-02-25 08:31:42 +11:00
Christopher Kohlhoff
d326bbe3c9 Add friendship support to execution::bulk_guarantee property. 2021-02-25 08:31:31 +11:00
Christopher Kohlhoff
2bb4a55353 Add friendship support to execution::blocking_adaptation property. 2021-02-25 08:31:22 +11:00
Christopher Kohlhoff
61bde74b5b Add friendship support to execution::blocking property. 2021-02-25 08:31:13 +11:00
Christopher Kohlhoff
6a4c1eec04 Add friendship support to require_concept CPO. 2021-02-25 08:31:03 +11:00
Christopher Kohlhoff
7e167636fe Add friendship support to prefer CPO. 2021-02-25 08:30:55 +11:00
Christopher Kohlhoff
35fc524368 Add friendship support to require CPO. 2021-02-25 08:30:46 +11:00