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.6 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,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 65C141F5AE for ; Wed, 28 Apr 2021 16:15:07 +0000 (UTC) Received: from localhost ([::1]:49532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbmqA-0005Vx-72 for normalperson@yhbt.net; Wed, 28 Apr 2021 12:15:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbmLw-0003N1-MP for bug-gnulib@gnu.org; Wed, 28 Apr 2021 11:43:53 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]:45681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbmLu-0006De-Aq for bug-gnulib@gnu.org; Wed, 28 Apr 2021 11:43:52 -0400 Received: by mail-lj1-x231.google.com with SMTP id d15so21520756ljo.12 for ; Wed, 28 Apr 2021 08:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=844jEpG1L/VwnEgNJuppXDh3ijk8eORZpAgy//Lbnog=; b=vFb7KOv6g+q9HgKSOkkD18wWtpwKqNiPBFspS0XIJ4a2+tjaKIN1bxwM6nVggE28t8 97skGXB9iY6eT4ugX4q2B+TBrJRmWsZQVJzcrxBNwjkDgCpggPEPBSphvhDavS1Ld+Iu VwTmw5NqPk3nL6UhgRzP0LOMX9LbY1FJfVH8cKNPeQnlZ3VObi0EXux+ZWuYgixC8+L7 loT6NPUSBq3S/GIaktKVcgA5iszj6fASROKWsCuOGee9F0qeuRqfXFhhnYjCpLo/zikr KzRBbpesz0JMJ5jGWL5Si6J6DlgNbqdDC3Q/FhC0WFFmnhH2ir6sYhMzukBk+4lYXl2w kbPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=844jEpG1L/VwnEgNJuppXDh3ijk8eORZpAgy//Lbnog=; b=acZn8lkQYJhaM59bKO5iAvhMehN+wZinJiSJcz+caCNS3iH8/yzett3CqR8jIDkKWI 2OPDO9oE6uTfBQPEGaF2ChxOuaRx8CJgLST5tccS8UK7MM97jBlp3aAU8adzse30nJmb YojawHw2+TxlVNN6NaZxPoiOzIqHVaHmbQyJupDp3yo/vP0u/e8Jna9DbAJc3hY21ngl IVIX2s+xmkiDTUT/0PJJFPE62F8r7Ijb0ap31ysICFTtMQ6rwOA0hqH8uGtSoB+xZjBy 6eTvVfpJ8vSCLrnU3FVrJL9Jvd5FJzHgKB6SU+wLsHXumx5/N0e9Xn9eq9H5tJHrc1oV PdTg== X-Gm-Message-State: AOAM532YJYz+0a4XiS1K5TvBG8v5bTgJ3fgOz2hAna9eRwBq4hdyWdna 19PQ5Mj0DUguz7WpJoO5i6than3kA9bBl8zGB+o= X-Google-Smtp-Source: ABdhPJyfsThIfeo4gsM9rWgQTz9lbT19WjIOGWU3ybwWYXyI4Gb+GnhP1qq9pnDND5+1ytrnjHIgEWNYGA7e4K0GtTo= X-Received: by 2002:a05:651c:383:: with SMTP id e3mr21523062ljp.242.1619624627823; Wed, 28 Apr 2021 08:43:47 -0700 (PDT) MIME-Version: 1.0 References: <2051587.bS8k0qy9eM@portable-bastien> <1632993.5ns3uf8gxi@omega> In-Reply-To: From: Bastien ROUCARIES Date: Wed, 28 Apr 2021 15:43:19 +0000 Message-ID: Subject: Re: Portabilty of poll trick To: Ben Pfaff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=roucaries.bastien@gmail.com; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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" Le mar. 27 avr. 2021 =C3=A0 22:51, Ben Pfaff a =C3=A9= crit : > > 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= code > > > 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()? Yes I can but socket are bidirectionnal and cost more about memory/speed than pipe. Bastien