]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_trylock.c
Fix warnings
[pdclib] / opt / nothread / mtx_trylock.c
index 3333a86f2c313071d50055f7b532661f03a003f1..e7bd8852011e6ef7ee1a487b16b0b1eaab5c917d 100644 (file)
@@ -1,14 +1,12 @@
+#ifndef REGTEST\r
 #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
+       (*mtx)++;\r
+       return thrd_success;\r
 }\r
+#endif\r
 \r
 #ifdef TEST\r
 #include <_PDCLIB_test.h>\r
@@ -18,4 +16,4 @@ int main( void )
     return TEST_RESULTS;\r
 }\r
 \r
-#endif
\ No newline at end of file
+#endif\r