X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=3224e4732654c598b0fefda211fe3da2e18a8c1e;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=219271fd548949abce8bd75c34dd42e519418fc4 diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index bffc8b8..3224e47 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -3,21 +3,17 @@ 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> +#include "_PDCLIB_test.h" int main( void ) { return TEST_RESULTS; } -#endif \ No newline at end of file +#endif