X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=opt%2Fnothread%2Fmtx_trylock.c;h=cd0c701c6fed179ff7b10443a13e2a42fafb20b5;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hp=ae3275775046114800efb65ddebb12c0a4d752bd;hpb=b41576197133c1211d6ec353faf93f505f573b8a;p=pdclib diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index ae32757..cd0c701 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -1,11 +1,19 @@ -#include - -int mtx_trylock(mtx_t *mtx) -{ - if(*mtx) { - return thrd_error; - } else { - *mtx = 1; - return thrd_success; - } -} +#ifndef REGTEST +#include + +int mtx_trylock(mtx_t *mtx) +{ + (*mtx)++; + return thrd_success; +} +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif