|
From: | Paul Eggert |
Subject: | Re: new module 'thread-optim' |
Date: | Sun, 9 Aug 2020 00:51:48 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 8/8/20 1:26 PM, Bruno Haible wrote:
+# define IF_MT_DECL char optimize_for_single_thread = __libc_single_threaded +# define IF_MT if (optimize_for_single_thread)
That second line looks backward; when optimize_for_single_thread is nonzero, the process is single-threaded so "IF_MT" is true when single-threaded, not when multi-threaded.
Could you explain why macros like IF_MT_DECL and IF_MT are needed? That is, why wouldn't it suffice to have a Gnulib-supplied <sys/single_threaded.h> on non-glibc platforms, and have "enum { __libc_single_threaded = 0 };" in the Gnulib replacement? Typically it's better to avoid language-bending macros like IF_MT if we can.
[Prev in Thread] | Current Thread | [Next in Thread] |