Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 4975A2035F for ; Fri, 28 Oct 2016 20:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934958AbcJ1UtM (ORCPT ); Fri, 28 Oct 2016 16:49:12 -0400 Received: from bsmtp.bon.at ([213.33.87.14]:9928 "EHLO bsmtp.bon.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761899AbcJ1UtI (ORCPT ); Fri, 28 Oct 2016 16:49:08 -0400 Received: from dx.site (unknown [93.83.142.38]) by bsmtp.bon.at (Postfix) with ESMTPSA id 3t5G812pV0z5tlF; Fri, 28 Oct 2016 22:49:05 +0200 (CEST) Received: from [IPv6:::1] (localhost [IPv6:::1]) by dx.site (Postfix) with ESMTP id C21E5101; Fri, 28 Oct 2016 22:49:04 +0200 (CEST) Subject: Re: [PATCH] compat: Allow static initializer for pthreads on Windows To: Junio C Hamano References: <20161026215732.16411-1-sbeller@google.com> <93be5d21-6cb6-ee2b-9f4f-c2fe7c690d6c@kdbg.org> <67e38b43-0264-12f2-cca8-4b718ed7dc9d@kdbg.org> <34c88c40-2088-fd74-5d26-56c0599b7eb9@kdbg.org> <38b70094-5550-8512-7735-a6739f435803@kdbg.org> Cc: Jacob Keller , Johannes Schindelin , Stefan Beller , "git@vger.kernel.org" , Simon Ruderich , Jeff King From: Johannes Sixt Message-ID: Date: Fri, 28 Oct 2016 22:49:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 28.10.2016 um 22:29 schrieb Junio C Hamano: > Johannes Sixt writes: > >> Another problem with the proposed patch is that there is no >> declaration for attr_start() before the call in compat/mingw.c. We >> would have to move the declaration of attr_start() to cache.h (for >> example), because #including attr.h in compat/mingw.c is plainly >> wrong. However, it would not be a major offense to #include attr.h in >> common-main.c. But when we do that, we can certainly spare the few >> cycles to call pthread_mutex_init. > > That sounds like a good argument to have it in common-main.c. > > Would it mean that the code that defines the mutex needs to have > #ifdef that defines a no-op attr_start() and defines the mutex with > PTHREAD_MUTEX_INITILIZER with #else that just defines the mutex > without initializatin, with the real attr_start(), though? No. My intent was to call pthread_mutex_init for all platforms. We already call open("/dev/null") unconditionally on every program startup. The few cycles spent in pthread_mutex_init should be the least of our worries. -- Hannes