X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=20efc99403afcc8316c9133ff06a2e9913dc9e0b;hb=f9ee8785d3c18603033ffbf7099f2a032186f2f9;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hpb=217a2f477ad6dbbac816981589ee2f5a81dffd67;p=pdclib.old diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index bffc8b8..20efc99 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