summaryrefslogtreecommitdiff
path: root/lib/libc/include
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2009-12-17 20:41:27 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2009-12-17 20:41:27 +0000
commit5ff95453ccdf27240d470a7b6a2eb6ecc9935e37 (patch)
treed48bca09cea15105f9638836288a08334d4c16cd /lib/libc/include
parent1eea4693c3246a7cb6313f15f75e0e48dc5d2f56 (diff)
MFC 199606, 199614:
Add an internal _once() method. This works identical to pthread_once(3) with the additional property that it is safe for routines in libc to use in both single-threaded and multi-threaded processes. Multi-threaded processes use the pthread_once() implementation from the threading library while single-threaded processes use a simplified "stub" version internal to libc.
Notes
svn path=/stable/8/; revision=200648
Diffstat (limited to 'lib/libc/include')
-rw-r--r--lib/libc/include/libc_private.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index 50903f3c74fa..052eb13003bb 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -34,6 +34,7 @@
#ifndef _LIBC_PRIVATE_H_
#define _LIBC_PRIVATE_H_
+#include <sys/_pthreadtypes.h>
/*
* This global flag is non-zero when a process has created one
@@ -147,6 +148,12 @@ int _yp_check(char **);
void _init_tls(void);
/*
+ * Provides pthread_once()-like functionality for both single-threaded
+ * and multi-threaded applications.
+ */
+int _once(pthread_once_t *, void (*)(void));
+
+/*
* Set the TLS thread pointer
*/
void _set_tp(void *tp);