]> pd.if.org Git - pdclib.old/blobdiff - opt/nothread/mtx_unlock.c
opt/nothread: add support for recursion
[pdclib.old] / opt / nothread / mtx_unlock.c
index 214a06390a51e752f109b7d53fb1561291b72b03..97a93a67ac021e8c319c6966a0609859446dc511 100644 (file)
@@ -3,10 +3,9 @@
 \r
 int mtx_unlock(mtx_t *mtx)\r
 {\r
-       if(*mtx) {\r
-               *mtx = 0;\r
-               return thrd_success;\r
-       } else return thrd_error;\r
+       if(--(*mtx) >= 0)\r
+        return thrd_success;\r
+    return thrd_error;\r
 }\r
 #endif\r
 \r