X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=cd0c701c6fed179ff7b10443a13e2a42fafb20b5;hb=b5d36b0dfa121d20e9056cfbca097e3aab488bab;hp=bffc8b85b139b430df32c437585dd70fe06308b5;hpb=219271fd548949abce8bd75c34dd42e519418fc4;p=pdclib diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index bffc8b8..cd0c701 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -1,23 +1,19 @@ -#ifndef REGTEST -#include - -int mtx_trylock(mtx_t *mtx) -{ - if(*mtx) { - return thrd_error; - } else { - *mtx = 1; - return thrd_success; - } -} -#endif - -#ifdef TEST -#include <_PDCLIB_test.h> - -int main( void ) -{ - return TEST_RESULTS; -} - -#endif \ No newline at end of file +#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