From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 767E83858404 for ; Wed, 2 Nov 2022 21:30:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 767E83858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x430.google.com with SMTP id a14so120057wru.5 for ; Wed, 02 Nov 2022 14:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MXzgFJU0pewfOpIZqA9uJHv2ocKca7kMhUgrDdL/GDQ=; b=aV5+c9BNjhbwWIg/7Xtap/mZjveNh196lHHeV7bNH+MG85uxTdxILb8T7UmKei64VD PqE4med9m8HXCpfnTPgFAANIHI/GmGNYquuouFt3p4fvJUgoa/UIoxxWvR7l0rt7qVFv hvJM/nPIgIpH3PNEQbwEVyxUcnga7/UhM40FKnhECagYHf9M4oZb0Ig5/oY7INoPJ6qw bBOFkKY2WmFWAjvVdmF0fwVYi9ziZqKMSZzCrTxJ5VMeIEINiWCNS5NTA/YSUsTkKcgm YwWx4Xr3FQAMNL9o8j1YUjvqwMApWPlcNAzW/Y63WBeb7eo0+t9UJaQ55ADB1n1sBcjq TxXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MXzgFJU0pewfOpIZqA9uJHv2ocKca7kMhUgrDdL/GDQ=; b=d02eRlnVITf5C/YsMDtL7WHKXDdvqSE3jX+6qJmXCZ0dV408QPAXw9OAX3Yckpfwin Rs7ZAQXiOpNNkrVPE4HyYQteWszgGxEJSP7naSfq6Iwe+l/0SaHrFwixPlL12hrVrS0J PdNf5btBG7GI7E9W4ovj/3waQ/SAkiexPIG3nfRSUuWCkmNhGM+LUUvMLjp0EOI5N1LY ANkK2AqPs8Bd2mNkg67X9URrUigjjA9Iq9xY0CHp1HJVryN22IIlJKkjTiHgG8/kqJQR iFK1Hb5DW+wSp9T5p1zs/J7Jc+6L3v2uzhGozdxqfw9BBdWSMuFi1Dre5iXAhgVR7nCY P7Ew== X-Gm-Message-State: ACrzQf2WNm5go8MwWVebYpnMpNGBY6GmpIDGU2NuD239T9xpC4YijND/ 3WOT8zzhURiAedFD+3jlvdKHlA== X-Google-Smtp-Source: AMsMyM7qoDqodLRyDPlUdYRIYXYKp/NQ0ScsqNwi8zWsl+gFqVbpOR2t90gRUEA4ji7/EcvfMf2Tbw== X-Received: by 2002:a05:6000:1c1a:b0:236:8321:d875 with SMTP id ba26-20020a0560001c1a00b002368321d875mr16691437wrb.45.1667424638947; Wed, 02 Nov 2022 14:30:38 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id e11-20020adfe7cb000000b00236740c6e6fsm13537074wrn.100.2022.11.02.14.28.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 14:29:16 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: i.nixman@autistici.org Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: Adding a new thread model to GCC Date: Wed, 02 Nov 2022 22:27:58 +0100 Message-ID: <5630429.DvuYhMxLoT@fomalhaut> In-Reply-To: <966d57cf952e294ddfda6077b1a0075c@autistici.org> References: <0f1f223a-3756-1da3-bd1d-b87edd34e1f9@126.com> <2653976.mvXUDI8C0e@fomalhaut> <966d57cf952e294ddfda6077b1a0075c@autistici.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart5887418.lOV4Wx5bFT" Content-Transfer-Encoding: 7Bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: This is a multi-part message in MIME format. --nextPart5887418.lOV4Wx5bFT Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" > I was able to successfully build gcc-trunk using the provided patch. > moreover, I was able to successfully build all of the packages used in > the toolchain! > (gmp, mpfr, mpc, isl, libgnurx, bzip2, termcap, libffi, expat, ncurses, > readline, gdbm, tcl, tk, openssl, xz-utils, sqlite, python3, binutils, > gdb, make) Great! Did you check that C++ threads are enabled in your build? If they are, you must be able to run the attached C++ test; if they are not (because the MinGW64 build is configured for older versions of Windows), you need to configure the compiler with the option --enable-libstdcxx-threads. -- Eric Botcazou --nextPart5887418.lOV4Wx5bFT Content-Disposition: attachment; filename="t.cc" Content-Transfer-Encoding: 7Bit Content-Type: text/x-c++src; charset="UTF-8"; name="t.cc" #include #include #include #include #include #define NUM_THREADS 4 std::condition_variable cond; std::mutex mx; int started = 0; void do_thread () { std::unique_lock lock(mx); std::cout << "Start thread " << started << std::endl; if(++started >= NUM_THREADS) cond.notify_all(); else cond.wait(lock); } int main () { std::vector vec; for (int i = 0; i < NUM_THREADS; ++i) vec.emplace_back(&do_thread); for (int i = 0; i < NUM_THREADS; ++i) vec[i].join(); vec.clear(); return 0; } --nextPart5887418.lOV4Wx5bFT--