]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_lock.c
dos2unix
[pdclib] / opt / nothread / mtx_lock.c
index 0a1afbdc4cdd60bfedf3470d8e0bc2e6f0890c32..2c5a26df3bde69ac94390d356cfbfb94c98946c8 100644 (file)
@@ -1,10 +1,19 @@
-#include <threads.h>\r
-#include <assert.h>\r
-\r
-int mtx_lock(mtx_t *mtx)\r
-{\r
-       if(*mtx == 0) {\r
-               *mtx = 1;\r
-               return thrd_success;\r
-       } else return thrd_error;\r
-}
\ No newline at end of file
+#ifndef REGTEST
+#include <threads.h>
+
+int mtx_lock(mtx_t *mtx)
+{
+       (*mtx)++;
+       return thrd_success;
+}
+#endif
+
+#ifdef TEST
+#include "_PDCLIB_test.h"
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif