From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from latitanza.investici.org (latitanza.investici.org [IPv6:2001:888:2000:56::19]) by sourceware.org (Postfix) with ESMTPS id C22B4385416C; Fri, 21 Oct 2022 10:09:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C22B4385416C Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=autistici.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=autistici.org Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by latitanza.investici.org (Postfix) with ESMTP id 4Mv0ZX0T1czGp50; Fri, 21 Oct 2022 10:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1666346996; bh=13OAwVk250+wYVbj8hSLKrLRwuSScYojR1GOM/309A8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gPubHNQbBOb+I4wI8OHANqVh+OBg2OobSpSAEQJf/5lItoxW684LnUEjWImh2G90l kJsc4xDuVq97aQInhiuWZrePIfeAWeY3RrjYsKuSLAJ8yh1ngbtPxuVFZ5CA0hiVhk jyv6M3U2M4HMU4qqdaWJSi3bjnBxv6uZ3JN3At14= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: i.nixman@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4Mv0ZW65x6z5sjW; Fri, 21 Oct 2022 10:09:55 +0000 (UTC) MIME-Version: 1.0 Date: Fri, 21 Oct 2022 10:09:55 +0000 From: i.nixman@autistici.org To: Jonathan Wakely Cc: LIU Hao , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, Eric Botcazou Subject: Re: Adding a new thread model to GCC In-Reply-To: References: <0f1f223a-3756-1da3-bd1d-b87edd34e1f9@126.com> User-Agent: Roundcube Webmail Message-ID: <7277b1d9a835d8cc651ab112eac8c2e7@autistici.org> X-Sender: i.nixman@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-10-21 09:58, Jonathan Wakely via Libstdc++ wrote: > How does this compare with Eric B's proposal at > https://gcc.gnu.org/legacy-ml/gcc-patches/2019-06/msg01840.html ? > > It would be good if we can accept one of them for GCC 13, but I don't > know Windows well enough to determine which is better. I had the same question... I would like to understand what is the difference? Moreover I would like to understand what is the difference with the already added support for the winpthreads library? @LIU Hao, could you explain please? best! > On Sat, 1 Oct 2022 at 19:35, LIU Hao via Libstdc++ > wrote: >> >> Greetings. >> >> After some years I think it's time to put on this topic again. >> >> This patch series is an attempt to add a new thread model basing on >> the mcfgthread library >> (https://github.com/lhmouse/mcfgthread), which provides efficient >> implementations of mutexes, >> condition variables, once flags, etc. for native Windows. >> >> >> The first patch is necessary because somewhere in libgfortran, >> `pthread_t` is referenced. If the >> thread model is not `posix`, it fails to compile. >> >> The second patch implements `std::thread::hardware_concurrency()` for >> non-posix thread models. This >> would also work for the win32 thread model if `std::thread` would be >> supported in the future. >> >> The third patch adds the `mcf` thread model for GCC and its libraries. >> A new builtin macro >> `__USING_MCFGTHREAD__` is added to indicate whether this new thread >> model is in effect. This grants >> `std::mutex` and `std::once_flag` trivial destructors; >> `std::condition_variable` is a bit >> unfortunate because its destructor is non-trivial, but in reality no >> cleanup is performed. >> >> >> I have been bootstrapping GCC with the MCF thread model for more than >> five years. At the moment, C, >> C++ and Fortran are supported. Ada is untested because I don't know >> how to bootstrap it. Objective-C >> is not supported, because threading APIs for libobjc have not been >> implemented. >> >> Please review. If there are any changes that I have to make, let me >> know. >> >> >> -- >> Best regards, >> LIU Hao