diff --git a/limelight-common/PlatformThreads.c b/limelight-common/PlatformThreads.c index 8113912..71ca562 100644 --- a/limelight-common/PlatformThreads.c +++ b/limelight-common/PlatformThreads.c @@ -157,7 +157,7 @@ int PltCreateThread(ThreadEntry entry, void* context, PLT_THREAD *thread) { return -1; } thread->cancelled = 0; - thread->handle = CreateThread(NULL, 0, ThreadProc, ctx, 0, &thread->tid); + thread->handle = CreateThread(NULL, 0, ThreadProc, ctx, CREATE_SUSPENDED, &thread->tid); if (thread->handle == NULL) { CloseHandle(thread->termevent); free(ctx); @@ -170,6 +170,9 @@ int PltCreateThread(ThreadEntry entry, void* context, PLT_THREAD *thread) { thread_head = thread; PltUnlockMutex(&thread_list_lock); + // Now the thread can run + ResumeThread(thread->handle); + err = 0; } } diff --git a/limelight-common/PlatformThreads.h b/limelight-common/PlatformThreads.h index dec8841..2a30205 100644 --- a/limelight-common/PlatformThreads.h +++ b/limelight-common/PlatformThreads.h @@ -40,6 +40,12 @@ CreateThread( _In_ DWORD dwCreationFlags, _Out_opt_ LPDWORD lpThreadId ); + +DWORD +WINAPI +ResumeThread( + _In_ HANDLE hThread +); #endif int initializePlatformThreads(void);