public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: FIFO: remove the arm method Date: Fri, 8 May 2020 11:29:27 +0000 (GMT) [thread overview] Message-ID: <20200508112927.33859396EC8C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=25e8727368a1565dac565bf89c5effced5f0ada2 commit 25e8727368a1565dac565bf89c5effced5f0ada2 Author: Ken Brown <kbrown@cornell.edu> Date: Thu Apr 23 08:14:05 2020 -0400 Cygwin: FIFO: remove the arm method There's no reason to check for errors when we set read_ready or write_ready. We don't do that for other events. Diff: --- winsup/cygwin/fhandler.h | 1 - winsup/cygwin/fhandler_fifo.cc | 34 +++------------------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index c8f7a39a2..4d691a0fc 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1343,7 +1343,6 @@ public: void set_close_on_exec (bool val); void __reg3 raw_read (void *ptr, size_t& ulen); ssize_t __reg3 raw_write (const void *ptr, size_t ulen); - bool arm (HANDLE h); bool need_fixup_before () const { return reader; } int fixup_before_fork_exec (DWORD) { stop_listen_client (); return 0; } void init_fixup_before (); diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index fb20e5a7e..44919c19e 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -93,28 +93,6 @@ sec_user_cloexec (bool cloexec, PSECURITY_ATTRIBUTES sa, PSID sid) return cloexec ? sec_user_nih (sa, sid) : sec_user (sa, sid); } -bool inline -fhandler_fifo::arm (HANDLE h) -{ -#ifdef DEBUGGING - const char *what; - if (h == read_ready) - what = "reader"; - else - what = "writer"; - debug_only_printf ("arming %s", what); -#endif - - bool res = SetEvent (h); - if (!res) -#ifdef DEBUGGING - debug_printf ("SetEvent for %s failed, %E", what); -#else - debug_printf ("SetEvent failed, %E"); -#endif - return res; -} - static HANDLE create_event () { @@ -348,11 +326,7 @@ fhandler_fifo::listen_client_thread () api_fatal ("Can't add a client handler, %E"); /* Allow a writer to open. */ - if (!arm (read_ready)) - { - __seterrno (); - goto out; - } + SetEvent (read_ready); /* Listen for a writer to connect to the new client handler. */ fifo_client_handler& fc = fc_handler[nhandlers - 1]; @@ -555,10 +529,8 @@ fhandler_fifo::open (int flags, mode_t) if (NT_SUCCESS (status)) { set_pipe_non_blocking (get_handle (), flags & O_NONBLOCK); - if (!arm (write_ready)) - res = error_set_errno; - else - res = success; + SetEvent (write_ready); + res = success; goto out; } else if (STATUS_PIPE_NO_INSTANCE_AVAILABLE (status))
reply other threads:[~2020-05-08 11:29 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=20200508112927.33859396EC8C@sourceware.org \ --to=kbrown@sourceware.org \ --cc=cygwin-cvs@sourceware.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: linkBe 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).