X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_unlock.c;h=d22d40e0ed3c75859ea614771950293c577a8236;hb=0694aac9fb1190feaa4fb3ff6d55175e0ac48e52;hp=1c11401f7931788068b98ec49bc0ec625d871a22;hpb=bb22ff7ecd9fe8f4641484df12ad629cd8ee27ac;p=pdclib.old diff --git a/opt/nothread/mtx_unlock.c b/opt/nothread/mtx_unlock.c index 1c11401..d22d40e 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> @@ -16,4 +17,4 @@ int main( void ) return TEST_RESULTS; } -#endif \ No newline at end of file +#endif