X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_unlock.c;h=97a93a67ac021e8c319c6966a0609859446dc511;hb=62024711e10c2b27e097e0e8876689ae6187e28d;hp=02244bbed591b682cc065cf694e72f4a73a7cccb;hpb=97dd2fddbdb56005b16a1b0aa19ed15cd77269fc;p=pdclib.old diff --git a/opt/nothread/mtx_unlock.c b/opt/nothread/mtx_unlock.c index 02244bb..97a93a6 100644 --- a/opt/nothread/mtx_unlock.c +++ b/opt/nothread/mtx_unlock.c @@ -1,9 +1,20 @@ +#ifndef REGTEST #include int mtx_unlock(mtx_t *mtx) { - if(*mtx) { - *mtx = 0; - return thrd_success; - } else return thrd_error; -} \ No newline at end of file + if(--(*mtx) >= 0) + return thrd_success; + return thrd_error; +} +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif \ No newline at end of file