]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_trylock.c
dos2unix
[pdclib] / opt / nothread / mtx_trylock.c
index ae3275775046114800efb65ddebb12c0a4d752bd..cd0c701c6fed179ff7b10443a13e2a42fafb20b5 100644 (file)
@@ -1,11 +1,19 @@
-#include <threads.h>\r
-\r
-int mtx_trylock(mtx_t *mtx)\r
-{\r
-       if(*mtx) {\r
-               return thrd_error;\r
-       } else {\r
-               *mtx = 1;\r
-               return thrd_success;\r
-       }\r
-}\r
+#ifndef REGTEST
+#include <threads.h>
+
+int mtx_trylock(mtx_t *mtx)
+{
+       (*mtx)++;
+       return thrd_success;
+}
+#endif
+
+#ifdef TEST
+#include "_PDCLIB_test.h"
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif