]> pd.if.org Git - pdclib.old/blobdiff - opt/nothread/mtx_unlock.c
[dlmalloc] correct definition of MMAP
[pdclib.old] / opt / nothread / mtx_unlock.c
index 1c11401f7931788068b98ec49bc0ec625d871a22..d22d40e0ed3c75859ea614771950293c577a8236 100644 (file)
@@ -1,12 +1,13 @@
+#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
+       if(--(*mtx) >= 0)\r
+        return thrd_success;\r
+    return thrd_error;\r
 }\r
+#endif\r
 \r
 #ifdef TEST\r
 #include <_PDCLIB_test.h>\r
@@ -16,4 +17,4 @@ int main( void )
     return TEST_RESULTS;\r
 }\r
 \r
-#endif
\ No newline at end of file
+#endif\r