]> pd.if.org Git - pdclib/blob - opt/nothread/mtx_lock.c
0a1afbdc4cdd60bfedf3470d8e0bc2e6f0890c32
[pdclib] / opt / nothread / mtx_lock.c
1 #include <threads.h>\r
2 #include <assert.h>\r
3 \r
4 int mtx_lock(mtx_t *mtx)\r
5 {\r
6         if(*mtx == 0) {\r
7                 *mtx = 1;\r
8                 return thrd_success;\r
9         } else return thrd_error;\r
10 }