]> pd.if.org Git - pdclib/blobdiff - opt/nothread/call_once.c
dos2unix
[pdclib] / opt / nothread / call_once.c
index 3bdca049a2f6d3e1dd2734a458d89946a3338299..6673d611a177a3981b2df6e46d5bcb816e4e5d8d 100644 (file)
@@ -1,40 +1,40 @@
-#ifndef REGTEST\r
-#include <threads.h>\r
-\r
-void _PDCLIB_call_once(_PDCLIB_once_flag *flag, void (*func)(void))\r
-{\r
-       if(!_PDCLIB_ONCE_FLAG_IS_DONE(flag)) {\r
-               func();\r
-               *flag = 1;\r
-       }\r
-}\r
-#endif\r
-\r
-#ifdef TEST\r
-#include "_PDCLIB_test.h"\r
-\r
-#ifndef REGTEST\r
-static int count = 0;\r
-static once_flag once = ONCE_FLAG_INIT;\r
-\r
-static void do_once(void)\r
-{\r
-    count++;\r
-}\r
-#endif\r
-\r
-int main( void )\r
-{\r
-#ifndef REGTEST\r
-    TESTCASE(count == 0);\r
-    call_once(&once, do_once);\r
-    TESTCASE(count == 1);\r
-    call_once(&once, do_once);\r
-    TESTCASE(count == 1);\r
-    do_once();\r
-    TESTCASE(count == 2);\r
-#endif\r
-    return TEST_RESULTS;\r
-}\r
-\r
-#endif\r
+#ifndef REGTEST
+#include <threads.h>
+
+void _PDCLIB_call_once(_PDCLIB_once_flag *flag, void (*func)(void))
+{
+       if(!_PDCLIB_ONCE_FLAG_IS_DONE(flag)) {
+               func();
+               *flag = 1;
+       }
+}
+#endif
+
+#ifdef TEST
+#include "_PDCLIB_test.h"
+
+#ifndef REGTEST
+static int count = 0;
+static once_flag once = ONCE_FLAG_INIT;
+
+static void do_once(void)
+{
+    count++;
+}
+#endif
+
+int main( void )
+{
+#ifndef REGTEST
+    TESTCASE(count == 0);
+    call_once(&once, do_once);
+    TESTCASE(count == 1);
+    call_once(&once, do_once);
+    TESTCASE(count == 1);
+    do_once();
+    TESTCASE(count == 2);
+#endif
+    return TEST_RESULTS;
+}
+
+#endif