X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_unlock.c;h=97a93a67ac021e8c319c6966a0609859446dc511;hb=62024711e10c2b27e097e0e8876689ae6187e28d;hp=214a06390a51e752f109b7d53fb1561291b72b03;hpb=8c3db524fec3b6bb85d2a2cc5cd889a63405e5f1;p=pdclib.old diff --git a/opt/nothread/mtx_unlock.c b/opt/nothread/mtx_unlock.c index 214a063..97a93a6 100644 --- a/opt/nothread/mtx_unlock.c +++ b/opt/nothread/mtx_unlock.c @@ -3,10 +3,9 @@ int mtx_unlock(mtx_t *mtx) { - if(*mtx) { - *mtx = 0; - return thrd_success; - } else return thrd_error; + if(--(*mtx) >= 0) + return thrd_success; + return thrd_error; } #endif