Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2019 11:06:24 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        arch@freebsd.org
Subject:   Re: switch to non-zero PTHREAD_*_INITIALIZER
Message-ID:  <93026.1549883184@critter.freebsd.dk>
In-Reply-To: <20190211103807.GX24863@kib.kiev.ua>
References:  <92707.1549878222@critter.freebsd.dk> <20190211103807.GX24863@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--------
In message <20190211103807.GX24863@kib.kiev.ua>, Konstantin Belousov writes:
>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.

Right, we probably should make it tweakable with something like /etc/malloc.conf.


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?93026.1549883184>