]> pd.if.org Git - pdclib/blobdiff - platform/win32/functions/threads/mtx_init.c
win32: initial pass at thread support
[pdclib] / platform / win32 / functions / threads / mtx_init.c
diff --git a/platform/win32/functions/threads/mtx_init.c b/platform/win32/functions/threads/mtx_init.c
new file mode 100644 (file)
index 0000000..19db390
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef REGTEST\r
+#include <threads.h>\r
+#include <windows.h>\r
+\r
+int mtx_init(mtx_t *mtx, int type)\r
+{\r
+    mtx->_WaitEvHandle = CreateEvent(NULL, \r
+        /* bManualReset*/   FALSE, \r
+        /* bInitialState*/  FALSE, \r
+        /* name*/           NULL);\r
+    if(mtx->_WaitEvHandle == NULL)\r
+        return thrd_error;\r
+    \r
+    mtx->_State        = -1;\r
+    mtx->_ThreadId     = 0;\r
+    mtx->_NestCount    = 0;;\r
+\r
+    return thrd_success;\r
+}\r
+#endif\r
+\r
+#ifdef TEST\r
+#include <_PDCLIB_test.h>\r
+\r
+int main( void )\r
+{\r
+    return TEST_RESULTS;\r
+}\r
+\r
+#endif
\ No newline at end of file