Bruno Haible <[EMAIL PROTECTED]> writes:
> Some multithread-safe libraries need not only locking, but also per-thread
> storage. I propose to add this module that provides TLS.
That sounds like a nice thing to add. Thanks. One quibble:
> # define gl_tls_key_init(NAME, DESTRUCTOR) \
> if (pthread_in_use ()) \
> { \
> if (pthread_key_create (&(NAME).key, DESTRUCTOR) != 0) \
> abort (); \
> } \
> else \
> (NAME).singlethread_value = NULL
This sort of macro will cause warnings with GCC and other compilers
if you use it in a context like this:
if (foo)
gl_tls_key_init (name, destructor);
because the compiler will warn about possible if-then-else nesting
problems. The usual do { ... } while (0) construct avoids this
problem.
_______________________________________________
bug-gnulib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnulib