aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/nptl')
-rw-r--r--sysdeps/nptl/libc-lockP.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h
index e573689799..aad9c9778c 100644
--- a/sysdeps/nptl/libc-lockP.h
+++ b/sysdeps/nptl/libc-lockP.h
@@ -210,9 +210,15 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
#endif
-/* Call handler iff the first call. */
-#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+/* Call handler iff the first call. Use a local call in libc, but the
+ global pthread_once symbol elsewhere. */
+#if IS_IN (libc)
+# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
__pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
+#else
+# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+ pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
+#endif
/* Get once control variable. */
#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)