X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=e7bd8852011e6ef7ee1a487b16b0b1eaab5c917d;hb=ad695562522feac5197c19716dd91922f229cf32;hp=3333a86f2c313071d50055f7b532661f03a003f1;hpb=bb22ff7ecd9fe8f4641484df12ad629cd8ee27ac;p=pdclib.old diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index 3333a86..e7bd885 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -1,14 +1,12 @@ +#ifndef REGTEST #include int mtx_trylock(mtx_t *mtx) { - if(*mtx) { - return thrd_error; - } else { - *mtx = 1; - return thrd_success; - } + (*mtx)++; + return thrd_success; } +#endif #ifdef TEST #include <_PDCLIB_test.h> @@ -18,4 +16,4 @@ int main( void ) return TEST_RESULTS; } -#endif \ No newline at end of file +#endif