X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_lock.c;h=13b0d1ca6b5089e860d7c897c313da8d3239ca05;hb=ad695562522feac5197c19716dd91922f229cf32;hp=d086986555dcd48c6808122333bd51bad77b55fd;hpb=10f020f1a39804bbef8cd1cf35ef7c9a8e75c7d6;p=pdclib.old diff --git a/opt/nothread/mtx_lock.c b/opt/nothread/mtx_lock.c index d086986..13b0d1c 100644 --- a/opt/nothread/mtx_lock.c +++ b/opt/nothread/mtx_lock.c @@ -3,10 +3,8 @@ int mtx_lock(mtx_t *mtx) { - if(*mtx == 0) { - *mtx = 1; - return thrd_success; - } else return thrd_error; + (*mtx)++; + return thrd_success; } #endif @@ -18,4 +16,4 @@ int main( void ) return TEST_RESULTS; } -#endif \ No newline at end of file +#endif