bug-gnulib
[Top][All Lists]
Advanced

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

fix conflict between 'thread' and 'pthread_sigmask' modules


From: Bruno Haible
Subject: fix conflict between 'thread' and 'pthread_sigmask' modules
Date: Wed, 16 Aug 2017 20:42:12 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-91-generic; KDE/5.18.0; x86_64; ; )

On FreeBSD 11.0, the POSIX testdir produces a crash of the test-pthread_sigmask2
test. It crashes right at the first call to pthread_sigmask:

   ASSERT (pthread_sigmask (1729, &set, NULL) == EINVAL);

The reason is that pthread_sigmask is #defined to rpl_pthread_sigmask
and rpl_pthread_sigmask is defined as a weak symbol

  $ nm test-pthread_sigmask2.o | grep pthread_sigmask
                   w rpl_pthread_sigmask

because test-pthread_sigmask2.c happens to include first <signal.h> and then
glthread/thread.h.

This patch fixes it (and makes sure that when pthread_sigmask is needed by
the 'thread' module, we get the right one).


2017-08-16  Bruno Haible  <address@hidden>

        thread: Fix conflict with pthread_sigmask module.
        * lib/glthread/thread.h (pthread_sigmask): Don't declare it weak if
        it's defined as a macro.
        * modules/thread (Depends-on): Add pthread_sigmask.

diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h
index 72bdd9b..52336c6 100644
--- a/lib/glthread/thread.h
+++ b/lib/glthread/thread.h
@@ -128,7 +128,9 @@ extern int glthread_in_use (void);
   /* Without this, clang complains that pthread_sigmask is never declared.  */
 #   include <signal.h>
 #  endif
-#  pragma weak pthread_sigmask
+#  ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak.  */
+#   pragma weak pthread_sigmask
+#  endif
 
 #  pragma weak pthread_join
 #  ifndef pthread_self
diff --git a/modules/thread b/modules/thread
index 026e439..b4e9d78 100644
--- a/modules/thread
+++ b/modules/thread
@@ -10,6 +10,7 @@ Depends-on:
 threadlib
 extern-inline
 lock
+pthread_sigmask [test $gl_threads_api = posix]
 
 configure.ac:
 gl_THREAD




reply via email to

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