X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=3224e4732654c598b0fefda211fe3da2e18a8c1e;hp=ae3275775046114800efb65ddebb12c0a4d752bd;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=b41576197133c1211d6ec353faf93f505f573b8a diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index ae32757..3224e47 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