X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=e7bd8852011e6ef7ee1a487b16b0b1eaab5c917d;hb=b641165a0d122178a33070e3434ab7b49397ad94;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hpb=10f020f1a39804bbef8cd1cf35ef7c9a8e75c7d6;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