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.

Reply via email to