]> pd.if.org Git - pdclib/blobdiff - opt/nothread/mtx_trylock.c
* Change the style of inclusion of the internal/ headers. Modern preprocessors
[pdclib] / opt / nothread / mtx_trylock.c
diff --git a/opt/nothread/mtx_trylock.c b/opt/nothread/mtx_trylock.c
new file mode 100644 (file)
index 0000000..ae32757
--- /dev/null
@@ -0,0 +1,11 @@
+#include <threads.h>\r
+\r
+int mtx_trylock(mtx_t *mtx)\r
+{\r
+       if(*mtx) {\r
+               return thrd_error;\r
+       } else {\r
+               *mtx = 1;\r
+               return thrd_success;\r
+       }\r
+}\r