bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'thread-optim'


From: Paul Eggert
Subject: Re: new module 'thread-optim'
Date: Tue, 11 Aug 2020 18:02:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 8/9/20 2:44 AM, Bruno Haible wrote:
To me, this variable '__libc_single_threaded' is not something that should
be visible in source code
   - because it is so low-level,
   - because only one platform has it.

True enough, but how about suggesting that people write something like the following?

   bool mt = gl_multithreaded ();
   if (mt) gl_lock_lock (file_cleanup_list_lock);
   ...
   if (mt) gl_lock_unlock (file_cleanup_list_lock);

This is nearly as concise as the IF_MT_DECL and IF_MT macros, allows for further enhancements by builtin_expect etc., and avoids the macro hackery.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]