X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=e7bd8852011e6ef7ee1a487b16b0b1eaab5c917d;hb=3a2027b97e7a6c7ecb9fcd4c24b4c74459faddbc;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hpb=217a2f477ad6dbbac816981589ee2f5a81dffd67;p=pdclib.old diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index bffc8b8..e7bd885 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -3,12 +3,8 @@ int mtx_trylock(mtx_t *mtx) { - if(*mtx) { - return thrd_error; - } else { - *mtx = 1; - return thrd_success; - } + (*mtx)++; + return thrd_success; } #endif @@ -20,4 +16,4 @@ int main( void ) return TEST_RESULTS; } -#endif \ No newline at end of file +#endif