From 93662d11c779c72776cc2836d1baacf0eefc1397 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Thu, 16 May 2019 18:05:54 +0300 Subject: [PATCH] Update thread.c --- src/win/thread.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/win/thread.c b/src/win/thread.c index 47a6706..9b9b97a 100644 --- a/src/win/thread.c +++ b/src/win/thread.c @@ -20,14 +20,14 @@ static DWORD WINAPI thread_entry(void *arg) { - tm_thread_entry entry; - - /* to call free before calling thread func */ - memcpy(&entry, arg, sizeof(entry)); - free(arg); - - entry.func(entry.arg); - + tm_thread_entry entry; + + /* to call free before calling thread func */ + memcpy(&entry, arg, sizeof(entry)); + free(arg); + + entry.func(entry.arg); + return 0; } @@ -37,17 +37,17 @@ thread_new(void (*func)(void *), void *obj) { tm_allocator *alc; tm_thread *th; tm_thread_entry *entry; - - - alc = tm_get_allocator(); - th = alc->calloc(1, sizeof(*th)); - entry = calloc(1, sizeof(*entry)); - entry->func = func; + + + alc = tm_get_allocator(); + th = alc->calloc(1, sizeof(*th)); + entry = calloc(1, sizeof(*entry)); + entry->func = func; entry->arg = obj; - th->id = CreateThread(NULL, 0, thread_entry, entry, 0, NULL); + th->id = CreateThread(NULL, 0, thread_entry, entry, 0, NULL); - return th; + return th; } TM_HIDE