public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-8907] libstdc++: Clarify argument to net::io_context::async_wait
Date: Tue, 24 Aug 2021 16:00:16 +0000 (GMT)	[thread overview]
Message-ID: <20210824160016.866B43857804@sourceware.org> (raw)

https://gcc.gnu.org/g:8140362761e9c225023f42c28647babd548dc653

commit r11-8907-g8140362761e9c225023f42c28647babd548dc653
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Apr 23 13:31:33 2021 +0100

    libstdc++: Clarify argument to net::io_context::async_wait
    
    Add a comment documenting the __w parameter of the private
    ios_context::async_wait function. Add casts to callers, making the
    conversions explicit.
    
    libstdc++-v3/ChangeLog:
    
            * include/experimental/io_context (io_context::async_wait): Add
            comment.
            * include/experimental/socket (basic_socket::async_connect):
            Cast wait_type constant to int.
            (basic_datagram_socket::async_receive): Likewise.
            (basic_datagram_socket::async_receive_from): Likewise.
            (basic_datagram_socket::async_send): Likewise.
            (basic_datagram_socket::async_send_to): Likewise.
            (basic_stream_socket::async_receive): Likewise.
            (basic_stream_socket::async_send): Likewise. Use io_context
            parameter directly, instead of via an executor.
            (basic_socket_acceptor::async_accept): Likewise.
    
    (cherry picked from commit 3517dfe05c05a48885149334143230fcf0ebe6be)

Diff:
---
 libstdc++-v3/include/experimental/io_context |  3 +++
 libstdc++-v3/include/experimental/socket     | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/libstdc++-v3/include/experimental/io_context b/libstdc++-v3/include/experimental/io_context
index c82f30cd119..82d7b4f545e 100644
--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -475,6 +475,9 @@ inline namespace v1
 	return 0;
       }
 
+    // The caller must know what the wait-type __w will be interpreted.
+    // In the current implementation the reactor is based on <poll.h>
+    // so the parameter must be one of POLLIN, POLLOUT or POLLERR.
     template<typename _Op>
       void
       async_wait(int __fd, int __w, _Op&& __op)
diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket
index ec4ed9d95e2..09c3b729607 100644
--- a/libstdc++-v3/include/experimental/socket
+++ b/libstdc++-v3/include/experimental/socket
@@ -954,7 +954,7 @@ inline namespace v1
 	    }
 
 	  get_executor().context().async_wait( native_handle(),
-	      socket_base::wait_read,
+	      (int) socket_base::wait_read,
 	      [__h = std::move(__init.completion_handler),
                __ep = std::move(__endpoint),
                __fd = native_handle()]
@@ -1165,7 +1165,7 @@ inline namespace v1
             __init{__token};
 
 	  this->get_executor().context().async_wait(this->native_handle(),
-	      socket_base::wait_read,
+	      (int) socket_base::wait_read,
 	      [__h = std::move(__init.completion_handler),
                &__buffers, __flags = static_cast<int>(__flags),
                __fd = this->native_handle()]
@@ -1271,7 +1271,7 @@ inline namespace v1
             __init{__token};
 
 	  this->get_executor().context().async_wait( this->native_handle(),
-	      socket_base::wait_read,
+	      (int) socket_base::wait_read,
 	      [__h = std::move(__init.completion_handler),
                &__buffers, __flags = static_cast<int>(__flags),
                __sender = std::move(__sender),
@@ -1366,7 +1366,7 @@ inline namespace v1
             __init{__token};
 
 	  this->get_executor().context().async_wait( this->native_handle(),
-	      socket_base::wait_write,
+	      (int) socket_base::wait_write,
 	      [__h = std::move(__init.completion_handler),
                &__buffers, __flags = static_cast<int>(__flags),
                __fd = this->native_handle()]
@@ -1469,7 +1469,7 @@ inline namespace v1
             __init{__token};
 
 	  this->get_executor().context().async_wait( this->native_handle(),
-	      socket_base::wait_write,
+	      (int) socket_base::wait_write,
 	      [__h = std::move(__init.completion_handler),
                &__buffers, __flags = static_cast<int>(__flags),
                __recipient = std::move(__recipient),
@@ -1634,7 +1634,7 @@ inline namespace v1
 	    }
 
           this->get_executor().context().async_wait(this->native_handle(),
-	      socket_base::wait_read,
+	      (int) socket_base::wait_read,
 	      [__h = std::move(__init.completion_handler),
                &__buffers, __flags = static_cast<int>(__flags),
                __fd = this->native_handle()]
@@ -1741,7 +1741,7 @@ inline namespace v1
 	    }
 
           this->get_executor().context().async_wait(this->native_handle(),
-	      socket_base::wait_write,
+	      (int) socket_base::wait_write,
 	      [__h = std::move(__init.completion_handler),
                &__buffers, __flags = static_cast<int>(__flags),
                __fd = this->native_handle()]
@@ -2098,8 +2098,8 @@ inline namespace v1
           async_completion<_CompletionToken, void(error_code, socket_type)>
             __init{__token};
 
-	  __ctx.get_executor().context().async_wait(native_handle(),
-	      socket_base::wait_read,
+	  __ctx.async_wait(native_handle(),
+	      (int) socket_base::wait_read,
 	      [__h = std::move(__init.completion_handler),
                __connabort = enable_connection_aborted(),
                __fd = native_handle(),
@@ -2189,8 +2189,8 @@ inline namespace v1
           async_completion<_CompletionToken, void(error_code, socket_type)>
             __init{__token};
 
-	  __ctx.get_executor().context().async_wait(native_handle(),
-	      socket_base::wait_read,
+	  __ctx.async_wait(native_handle(),
+	      (int) socket_base::wait_read,
 	      [__h = std::move(__init.completion_handler),
               __ep = std::move(__endpoint),
                __connabort = enable_connection_aborted(),


                 reply	other threads:[~2021-08-24 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824160016.866B43857804@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).