From: Bastien ROUCARIES <roucaries.bastien@gmail.com>
To: Ben Pfaff <blp@cs.stanford.edu>
Cc: Erik Blake <eblake@redhat.com>, bug-gnulib <bug-gnulib@gnu.org>,
Bruno Haible <bruno@clisp.org>,
Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: Portabilty of poll trick
Date: Wed, 28 Apr 2021 15:43:19 +0000 [thread overview]
Message-ID: <CAE2SPAbj4-2J7Rf0h5HSDj+42iuMzP26thjKi66y-fTYbWjjWQ@mail.gmail.com> (raw)
In-Reply-To: <CAA_G9+gmyjuSxUy1MOZKFMr5hZ9ZBdg48QUWKiNNFSO=z9+o7A@mail.gmail.com>
Le mar. 27 avr. 2021 à 22:51, Ben Pfaff <blp@cs.stanford.edu> a écrit :
>
> On Tue, Apr 27, 2021 at 3:47 PM Bastien ROUCARIES
> <roucaries.bastien@gmail.com> wrote:
> >
> > Le mar. 27 avr. 2021 à 22:40, Bruno Haible <bruno@clisp.org> a écrit :
> > >
> > > Hi Bastien,
> > >
> > > > I want to assess the safety and portability of the following trick,
> > >
> > > I would want to help you with this, but I can't. You have not stated:
> > > - What is this code supposed to do?
> > I want to shutdown (2) a pipe, in a multithread application, in order
> > to get out a poll(2) wait state
> > > - Why is it a "trick"? What advantages does it have compared to the code
> > > a naïve developer would write?
> > The naive delevopper will:
> > - close the end of the pipe, but it does not break poll(2), and
> > moreover in multithread context
> > it is not safe due to fd reuse
> > -use timeout but in this case why use poll...
> >
> > The goal is also to shutdown an eventfd but without kernel support, I
> > suppose it is not possible...
>
> Can you use socketpair() instead of pipe()?
Yes I can but socket are bidirectionnal and cost more about
memory/speed than pipe.
Bastien
next prev parent reply other threads:[~2021-04-28 16:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 7:14 Portabilty of poll trick Bastien Roucariès
2021-04-27 22:40 ` Bruno Haible
2021-04-27 22:46 ` Bastien ROUCARIES
2021-04-27 22:51 ` Ben Pfaff
2021-04-28 15:43 ` Bastien ROUCARIES [this message]
2021-05-14 10:43 ` Bruno Haible
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAE2SPAbj4-2J7Rf0h5HSDj+42iuMzP26thjKi66y-fTYbWjjWQ@mail.gmail.com \
--to=roucaries.bastien@gmail.com \
--cc=blp@cs.stanford.edu \
--cc=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eblake@redhat.com \
--cc=mtk.manpages@gmail.com \
/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).