From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.codeweavers.com (mail.codeweavers.com [65.103.31.132]) by sourceware.org (Postfix) with ESMTPS id F17893856DC0 for ; Fri, 21 Oct 2022 12:41:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F17893856DC0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=codeweavers.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=6377696661; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:To:Subject:MIME-Version:Date:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VE/oG9fMYCsVLAVFM0mudgXmlqjfZnaxqgE1VOIoPKM=; b=bqHC+VF4vgOjSAYlKf+D+02EbL rWviBDPPmCqv/LHeOO0y8pwuqs9vK1TDqnIc+0DVvJZHpeqlOxL9kYZETs7YNOOzPq+U8N8F5bCYp iLJWK9n2dz1xmmRAcbGPZVYSs2cd3odJQ1AcuS6uafX8lqzh/vUwF/mFH5qD66luLBn0=; Received: from cw141ip133.vpn.codeweavers.com ([10.69.141.133]) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1olrLM-005lCO-HI; Fri, 21 Oct 2022 07:41:44 -0500 Message-ID: <604b2d1c-b213-ac3a-0734-88b2ed53cd6a@codeweavers.com> Date: Fri, 21 Oct 2022 14:40:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: Adding a new thread model to GCC Content-Language: en-GB To: LIU Hao , GCC Patches References: <3d80a59c-39f4-85e0-3558-062ddcd5ece7@126.com> <9a0a656a-fc53-02e6-3e47-d2fd40fabe58@codeweavers.com> <38afe66e-3e5c-a3b1-89e8-43c964323229@126.com> From: Jacek Caban In-Reply-To: <38afe66e-3e5c-a3b1-89e8-43c964323229@126.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 10/21/22 14:29, LIU Hao wrote: > 在 2022/10/21 20:13, Jacek Caban 写道: >> >> This is not true for past 15 years, CRITICAL_SECTIONS use something >> like RtlWaitOnAddress (an equivalent of futexes) since Vista, see >> Wine implementation for details: >> https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/ntdll/sync.c#L190 >> >> > > Ah Jacek, nice to see you here. > > I haven't dug into this too much, though. From my limited knowledge > (mostly from reading disassembly) now CRITICAL_SECTION uses > `NtWaitForAlertByThreadId` (and no longer keyed events or semaphores). > As with `WaitOnAddress()`, there seems to be some global data > structure, protected by a spin lock. It's just another undocumented > syscall. Keyed events are still functional. NtWaitForAlertByThreadId() is an underlying syscall that's used by WaitOnAddress(). Anyway, you don't need to worry about that if you just use public CRITICAL_SECTION APIs. Jacek