X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=opt%2Fnothread%2Fmtx_trylock.c;h=3224e4732654c598b0fefda211fe3da2e18a8c1e;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hpb=5fd032eae66fba700cb9927840222b068c62361e;p=pdclib 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