X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fnothread%2Fmtx_lock.c;h=2c5a26df3bde69ac94390d356cfbfb94c98946c8;hp=121444e4b9a255d344825115c0ece923e512d3d7;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hpb=5155ca96295a12b4857fc0e6a9629cc43a9a85fa diff --git a/opt/nothread/mtx_lock.c b/opt/nothread/mtx_lock.c index 121444e..2c5a26d 100644 --- a/opt/nothread/mtx_lock.c +++ b/opt/nothread/mtx_lock.c @@ -1,20 +1,19 @@ -#include -#include - -int mtx_lock(mtx_t *mtx) -{ - if(*mtx == 0) { - *mtx = 1; - return thrd_success; - } else return thrd_error; -} - -#ifdef TEST -#include <_PDCLIB_test.h> - -int main( void ) -{ - return TEST_RESULTS; -} - -#endif \ No newline at end of file +#ifndef REGTEST +#include + +int mtx_lock(mtx_t *mtx) +{ + (*mtx)++; + return thrd_success; +} +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif