This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3, newlib] Only define static locks in multithreaded mode


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]