Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2019 09:43:42 +0000
From:      Poul-Henning Kamp <phk@phk.freebsd.dk>
To:        arch@freebsd.org
Subject:   switch to non-zero PTHREAD_*_INITIALIZER
Message-ID:  <92707.1549878222@critter.freebsd.dk>

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

-- 
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?92707.1549878222>