summaryrefslogtreecommitdiffstats
path: root/once.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-05-17 22:22:53 +0000
committerLennart Poettering <lennart@poettering.net>2007-05-17 22:22:53 +0000
commitbef6322859a5dc01e35d884de7afd2eabb1d9e4d (patch)
tree6431f409747005fca20998fe518c174c909fd385 /once.h
parentc58ce0879c1cabfd31dd8657d2594d78f13b1360 (diff)
at basic locking/threading support
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@26 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'once.h')
-rw-r--r--once.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/once.h b/once.h
new file mode 100644
index 0000000..a374529
--- /dev/null
+++ b/once.h
@@ -0,0 +1,17 @@
+#ifndef foosydneyoncehfoo
+#define foosydneyoncehfoo
+
+#include "mutex.h"
+
+typedef struct sa_once {
+ unsigned int once_value;
+ sa_mutex_t *mutex;
+} sa_once_t;
+
+#define SA_ONCE_INIT { .once_value = 0, .mutex = NULL }
+
+typedef void (*sa_once_func_t) (void);
+
+int sa_once(sa_once_t *o, sa_once_func_t f);
+
+#endif