]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_unlock.c
PDCLib includes with quotes, not <>.
[pdclib] / opt / nothread / mtx_unlock.c
index 02244bbed591b682cc065cf694e72f4a73a7cccb..a12c0a061123b40e2c5b3fe597cadb6336769b38 100644 (file)
@@ -1,9 +1,20 @@
+#ifndef REGTEST\r
 #include <threads.h>\r
 \r
 int mtx_unlock(mtx_t *mtx)\r
 {\r
-       if(*mtx) {\r
-               *mtx = 0;\r
-               return thrd_success;\r
-       } else return thrd_error;\r
-}
\ No newline at end of file
+       if(--(*mtx) >= 0)\r
+        return thrd_success;\r
+    return thrd_error;\r
+}\r
+#endif\r
+\r
+#ifdef TEST\r
+#include "_PDCLIB_test.h"\r
+\r
+int main( void )\r
+{\r
+    return TEST_RESULTS;\r
+}\r
+\r
+#endif\r