X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_trylock.c;h=cd0c701c6fed179ff7b10443a13e2a42fafb20b5;hb=4321ebdd142b534d8b7b6c31e01790f77ac46319;hp=3333a86f2c313071d50055f7b532661f03a003f1;hpb=5155ca96295a12b4857fc0e6a9629cc43a9a85fa;p=pdclib diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c index 3333a86..cd0c701 100644 --- a/opt/nothread/mtx_trylock.c +++ b/opt/nothread/mtx_trylock.c @@ -1,21 +1,19 @@ -#include - -int mtx_trylock(mtx_t *mtx) -{ - if(*mtx) { - return thrd_error; - } else { - *mtx = 1; - return thrd_success; - } -} - -#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