about summary refs log tree commit diff
path: root/sysdeps/stub/bits/libc-lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/stub/bits/libc-lock.h')
-rw-r--r--sysdeps/stub/bits/libc-lock.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdeps/stub/bits/libc-lock.h b/sysdeps/stub/bits/libc-lock.h
index fa4dcdde1d..9efd799dab 100644
--- a/sysdeps/stub/bits/libc-lock.h
+++ b/sysdeps/stub/bits/libc-lock.h
@@ -70,6 +70,20 @@
 /* Unlock the recursive named lock variable.  */
 #define __libc_lock_unlock_recursive(NAME)
 
+
+/* Define once control variable.  */
+#define __libc_once_define(NAME) int NAME = 0
+
+/* Call handler iff the first call.  */
+#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+  do {									      \
+    if ((ONCE_CONTROL) == 0) {						      \
+      INIT_FUNCTION ();							      \
+      (ONCE_CONTROL) = 1;						      \
+    }									      \
+  } while (0)
+
+
 /* Start critical region with cleanup.  */
 #define __libc_cleanup_region_start(FCT, ARG)