This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 2/3, newlib] Only define static locks in multithreaded mode
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib at sourceware dot org
- Date: Wed, 01 Feb 2017 09:48:43 +0100
- Subject: Re: [PATCH 2/3, newlib] Only define static locks in multithreaded mode
- Authentication-results: sourceware.org; auth=none
- References: <7a943313-48e7-2c8f-7250-ce47aeecda13@foss.arm.com>
On Tue, 2017-01-31 at 17:10 +0000, Thomas Preudhomme wrote:
> It also makes sure locking macros in lock.h are noop in single thread
> mode.
Doesn't it make all the guards in the code superfluous? If the lock
initialization macros are defined to be ";" and lock functions are
defined to be "(void)0", then the guards in the code actually guard
nothing, as things like:
#if !defined(__SINGLE_THREAD__) && defined(HAVE_DD_LOCK)
__LOCK_INIT(static, __dd_hash_mutex);
#endif
#ifndef __SINGLE_THREAD__
__lock_acquire(__dd_hash_mutex);
#endif
will then be equivalent to:
#if !defined(__SINGLE_THREAD__) && defined(HAVE_DD_LOCK)
;
#endif
#ifndef __SINGLE_THREAD__
(void)0;
#endif
Regards,
FCh