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

next in thread | previous in thread | raw e-mail | index | archive | help
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.



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