X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=20efc99403afcc8316c9133ff06a2e9913dc9e0b;hb=66650707acada328341a3812007307b1b9676803;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hpb=cce3efd57a644a1fa1ee8fcb14b6b934d40c10d2;p=pdclib 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