From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id ABA2E1F5AE for ; Tue, 27 Apr 2021 22:51:54 +0000 (UTC) Received: from localhost ([::1]:60344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbWYb-0008M2-PF for normalperson@yhbt.net; Tue, 27 Apr 2021 18:51:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbWYV-0008Lu-QC for bug-gnulib@gnu.org; Tue, 27 Apr 2021 18:51:47 -0400 Received: from smtp1.cs.stanford.edu ([171.64.64.25]:42850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbWYT-0004aG-H1 for bug-gnulib@gnu.org; Tue, 27 Apr 2021 18:51:47 -0400 Received: from mail-io1-f41.google.com ([209.85.166.41]:34481) by smtp1.cs.Stanford.EDU with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1lbWYP-0002Sq-Dk for bug-gnulib@gnu.org; Tue, 27 Apr 2021 15:51:41 -0700 Received: by mail-io1-f41.google.com with SMTP id l21so18016091iob.1 for ; Tue, 27 Apr 2021 15:51:41 -0700 (PDT) X-Gm-Message-State: AOAM530W+ioj/neS5deBVP/S9zrJfQAO5CA9XYK/fMQh3cmj3mZ+qgeh 8YkA77cNyiAr6RIuzrWLvU68qLh1RlfLJI8Joyw= X-Google-Smtp-Source: ABdhPJyxSr2/czgyfZ9wJF3YWL2eqwriASkEiTRxtPMSRemoE0iAJWuKjM4mY74McG+n02EkY7hdqvDN0djft6a8a+M= X-Received: by 2002:a05:6638:14c:: with SMTP id y12mr24121976jao.63.1619563900835; Tue, 27 Apr 2021 15:51:40 -0700 (PDT) MIME-Version: 1.0 References: <2051587.bS8k0qy9eM@portable-bastien> <1632993.5ns3uf8gxi@omega> In-Reply-To: From: Ben Pfaff Date: Tue, 27 Apr 2021 15:51:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Portabilty of poll trick To: Bastien ROUCARIES Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Scan-Signature: 5e15904e367bf57319d290d73554c551 Received-SPF: pass client-ip=171.64.64.25; envelope-from=blp@cs.stanford.edu; helo=smtp1.cs.Stanford.EDU X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Blake , bug-gnulib , Bruno Haible , Michael Kerrisk Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On Tue, Apr 27, 2021 at 3:47 PM Bastien ROUCARIES wrote: > > Le mar. 27 avr. 2021 =C3=A0 22:40, Bruno Haible a =C3= =A9crit : > > > > 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 c= ode > > a na=C3=AFve 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()?