From owner-freebsd-arch@freebsd.org Mon Feb 11 10:38:17 2019 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30F3D14D1E0E for ; Mon, 11 Feb 2019 10:38:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A43698E24C for ; Mon, 11 Feb 2019 10:38:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 6249114D1E09; Mon, 11 Feb 2019 10:38:16 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50C1F14D1E08 for ; Mon, 11 Feb 2019 10:38:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA09D8E245 for ; Mon, 11 Feb 2019 10:38:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x1BAc8TG090770 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 11 Feb 2019 12:38:11 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x1BAc8TG090770 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x1BAc7je090769; Mon, 11 Feb 2019 12:38:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 11 Feb 2019 12:38:07 +0200 From: Konstantin Belousov To: Poul-Henning Kamp Cc: arch@freebsd.org Subject: Re: switch to non-zero PTHREAD_*_INITIALIZER Message-ID: <20190211103807.GX24863@kib.kiev.ua> References: <92707.1549878222@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <92707.1549878222@critter.freebsd.dk> User-Agent: Mutt/1.11.2 (2019-01-07) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2019 10:38:17 -0000 On Mon, Feb 11, 2019 at 09:43:42AM +0000, Poul-Henning Kamp wrote: > Right now most of our PTHREAD_*_INITIALIZER macros are defined as NULL. > > This is a bad choice from a code quality point of view, because it means > that > > pthread_t my_mutex; > > and > > pthread_t my_mutes = PTHREAD_MUTEX_INITIALIZER; > > act the same, which they are not. > > I suggest that we should change the macros to a non-NULL value, and > add a check for NULL values which emit a warning about the lack of > initialization. > > Comments ? This would make the startup (or more) of current binaries too noisy and perhaps even break the applications that depend on specific output from the subordinate processes. I wanted to reorganize static initializizers for some time, esp. to add specific initializers like RECURSIVE_NP and similar. This requires more changes in libthr, particular to the shared and destroyed mutexes canary values, which is quite delicate thing to do. So far I did not spend time on this.