X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_unlock.c;h=97a93a67ac021e8c319c6966a0609859446dc511;hb=66650707acada328341a3812007307b1b9676803;hp=1c11401f7931788068b98ec49bc0ec625d871a22;hpb=5155ca96295a12b4857fc0e6a9629cc43a9a85fa;p=pdclib diff --git a/opt/nothread/mtx_unlock.c b/opt/nothread/mtx_unlock.c index 1c11401..97a93a6 100644 --- a/opt/nothread/mtx_unlock.c +++ b/opt/nothread/mtx_unlock.c @@ -1,12 +1,13 @@ +#ifndef REGTEST #include 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 #ifdef TEST #include <_PDCLIB_test.h>