summaryrefslogtreecommitdiff
path: root/nptl/threads.h
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/threads.h')
-rw-r--r--nptl/threads.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/nptl/threads.h b/nptl/threads.h
index 13d0075ea9..32f7cf8f75 100644
--- a/nptl/threads.h
+++ b/nptl/threads.h
@@ -48,6 +48,12 @@ enum
mtx_timed = 2
};
+typedef struct
+{
+ int __data __ONCE_ALIGNMENT;
+} once_flag;
+#define ONCE_FLAG_INIT { 0 }
+
typedef union
{
char __size[__SIZEOF_PTHREAD_MUTEX_T];
@@ -129,6 +135,11 @@ extern int mtx_unlock (mtx_t *__mutex);
/* Destroy the mutex object pointed by __MUTEX. */
extern void mtx_destroy (mtx_t *__mutex);
+
+/* Call function __FUNC exactly once, even if invoked from several threads.
+ All calls must be made with the same __FLAGS object. */
+extern void call_once (once_flag *__flag, void (*__func)(void));
+
__END_DECLS
#endif /* _THREADS_H */