Fix the Windows pthread_create shim

The current implementation doesn't actually set the out parameter,
and it returns 0 on failure instead of on success.
This commit is contained in:
boolemancer
2022-11-08 03:04:23 -08:00
committed by Georgi Gerganov
parent 4e5674a5d5
commit 0bfe728b84
2 changed files with 10 additions and 4 deletions

10
ggml.c
View File

@ -37,8 +37,14 @@ typedef HANDLE pthread_t;
typedef DWORD thread_ret_t;
static int pthread_create(pthread_t* out, void* unused, thread_ret_t(*func)(void*), void* arg) {
out = CreateThread(NULL, 0, func, arg, 0, NULL);
return out != NULL;
HANDLE handle = CreateThread(NULL, 0, func, arg, 0, NULL);
if (handle == NULL)
{
return EAGAIN;
}
*out = handle;
return 0;
}
static int pthread_join(pthread_t thread, void* unused) {