X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=20efc99403afcc8316c9133ff06a2e9913dc9e0b;hb=62024711e10c2b27e097e0e8876689ae6187e28d;hp=ae3275775046114800efb65ddebb12c0a4d752bd;hpb=97dd2fddbdb56005b16a1b0aa19ed15cd77269fc;p=pdclib.old diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index ae32757..20efc99 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -1,11 +1,19 @@ +#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> + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif \ No newline at end of file