]> pd.if.org Git - pdclib/blobdiff - platform/win32/functions/threads/mtx_unlock.c
win32: mutex rewrite. new form is much simpler
[pdclib] / platform / win32 / functions / threads / mtx_unlock.c
index 27b7aefadb7d6ff4a277c1e6fedadb27bca74e9d..1222c292ea42ffa47b934fb154ad3df68ef58a69 100644 (file)
@@ -11,19 +11,11 @@ int mtx_unlock(mtx_t *mtx)
     }\r
 \r
     mtx->_ThreadId = 0;\r
-\r
-    DWORD res = InterlockedDecrement(&mtx->_State);\r
-    if(res == (DWORD) -1) {\r
-        // We reset the state to -1; success!\r
-        return thrd_success;\r
-    }\r
-\r
     DWORD rv = SetEvent(mtx->_WaitEvHandle);\r
     if(rv == 0) {\r
         _PDCLIB_w32errno();\r
         return thrd_error;\r
     }\r
-\r
     return thrd_success;\r
 }\r
 #endif\r