]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_trylock.c
Fix warnings
[pdclib] / opt / nothread / mtx_trylock.c
index bffc8b85b139b430df32c437585dd70fe06308b5..e7bd8852011e6ef7ee1a487b16b0b1eaab5c917d 100644 (file)
@@ -3,12 +3,8 @@
 \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
@@ -20,4 +16,4 @@ int main( void )
     return TEST_RESULTS;\r
 }\r
 \r
-#endif
\ No newline at end of file
+#endif\r