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 9F6DB3856974 for ; Fri, 21 Oct 2022 12:15:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F6DB3856974 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=In-Reply-To:From:Subject:References:To: MIME-Version:Date:Message-ID:Content-Type:Sender:Reply-To:Cc: Content-Transfer-Encoding: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=ZdJSTJnx3cRfJZ4PQ0CaZn2mh+8xKfte4zY0FvEQpvw=; b=Lsvx/F+2CYiz4jOXFP4XR9GbLl DOXpI0DsQXoo/hjF5kJSiONg833iEWoCrd2A/j7m9S04d+8potW0vUANSKrXD7OXGoblGloYo66yR XLtzeSbhTMuk+sMHsdVgXKDfKCiA8w4/+wtoRyQyUtqONaB2g/bKx8MuGIYTrYbKQfVc=; 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 1olqvb-005jo0-NQ; Fri, 21 Oct 2022 07:15:07 -0500 Content-Type: multipart/alternative; boundary="------------VMso0PrdqgGBFPcR33MI9x00" Message-ID: <9a0a656a-fc53-02e6-3e47-d2fd40fabe58@codeweavers.com> Date: Fri, 21 Oct 2022 14:13:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 To: lh_mouse@126.com, GCC Patches References: <3d80a59c-39f4-85e0-3558-062ddcd5ece7@126.com> Subject: Re: Adding a new thread model to GCC Content-Language: en-GB From: Jacek Caban In-Reply-To: <3d80a59c-39f4-85e0-3558-062ddcd5ece7@126.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GB_TO_NAME_FREEMAIL,HTML_MESSAGE,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: This is a multi-part message in MIME format. --------------VMso0PrdqgGBFPcR33MI9x00 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit > The problem about this approach is that, semaphores are valuable kernel objects, and the maximum > number of HANDLEs that a process can open concurrently has a limit (like FDs on Linux), while 'many > critical sections are used only occasionally (or never at all), meaning the auto-reset event often > isn’t even necessary' [1], the semaphores are actually allocated on demand. This means that locking > can fail. There is a story in article [1] which also explains the origination of keyed events; it's > worth reading. 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 Jacek --------------VMso0PrdqgGBFPcR33MI9x00--