]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_trylock.c
opt/nothread: add support for recursion
[pdclib] / opt / nothread / mtx_trylock.c
index 3333a86f2c313071d50055f7b532661f03a003f1..20efc99403afcc8316c9133ff06a2e9913dc9e0b 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