Modify

Ticket #9001 (closed Feature Requests: fixed)

Opened 8 months ago

Last modified 7 months ago

asio::buffered_stream and family missing future returns

Reported by: vinnie.falco@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

I'm practically a novice but it seems that asio::buffered_read_stream and asio::buffered_write_stream async operations are missing the futures return value. I believe that asio::buffered_read_stream::async_read_some should have a function signature that looks like this:

  template <typename MutableBufferSequence, typename ReadHandler>
  BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
      void (boost::system::error_code, std::size_t))
  async_read_some(const MutableBufferSequence& buffers,
      BOOST_ASIO_MOVE_ARG(ReadHandler) handler)

I marked this as "Problem" because it is not possible to wrap either of these objects in such a way that they are fully compatible with future returns.

Note that classes like asio::basic_stream_socket all provide futures return values for async functions (when supported by the build configuration).

If I am incorrect please advise me so I can correct my own code because this is the model I am following

Attachments

Change History

comment:1 Changed 8 months ago by anonymous

It seems this is not a "std::future" return but more, a specialization of asio::async_result<> that allows a handler to produce a return value from an initiating function.

If user-defined handlers are going to be able to perfectly wrap boost::asio objects then they need ways of returning the async_result without relying on classes in a detail namespace.

comment:2 Changed 7 months ago by chris_kohlhoff

  • Status changed from new to closed
  • Resolution set to fixed

Fixed on trunk in [85798]. Merged to release in [85838]. See also #9000.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.