From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/replicant/nx/win/nxthread.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Src/replicant/nx/win/nxthread.c (limited to 'Src/replicant/nx/win/nxthread.c') diff --git a/Src/replicant/nx/win/nxthread.c b/Src/replicant/nx/win/nxthread.c new file mode 100644 index 00000000..0c049ad4 --- /dev/null +++ b/Src/replicant/nx/win/nxthread.c @@ -0,0 +1,25 @@ +#include "nxthread.h" +#include "foundation/error.h" + +int NXThreadCreate(nx_thread_t *thread, nx_thread_func_t thread_function, nx_thread_parameter_t parameter) +{ + *thread = (nx_thread_t)CreateThread(0, 0, thread_function, parameter, 0, 0); + return NErr_Success; +} + +int NXThreadJoin(nx_thread_t t, nx_thread_return_t *retval) +{ + if (!t) + return NErr_NullPointer; + WaitForSingleObject((HANDLE)t, INFINITE); + if (retval) + GetExitCodeThread((HANDLE)t, retval); + CloseHandle((HANDLE)t); + return NErr_Success; +} + +int NXThreadCurrentSetPriority(int priority) +{ + SetThreadPriority(GetCurrentThread(), priority); + return NErr_Success; +} \ No newline at end of file -- cgit