]> pd.if.org Git - pdclib.old/blobdiff - opt/nothread/mtx_lock.c
opt/nothread: add support for recursion
[pdclib.old] / opt / nothread / mtx_lock.c
index 121444e4b9a255d344825115c0ece923e512d3d7..efe26bd4de6f0b16ae7c706938ff56b4586fed77 100644 (file)
@@ -1,13 +1,12 @@
+#ifndef REGTEST\r
 #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
+       (*mtx)++;\r
+       return thrd_success;\r
 }\r
+#endif\r
 \r
 #ifdef TEST\r
 #include <_PDCLIB_test.h>\r